标签:
- Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
AxisFault
faultCode: {http://schemas.microsoft.com/ws/2005/05/addressing/none}ActionNotSupported
faultSubcode:
faultString: The message with Action ‘http://tempuri.org/addUser‘ cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:The message with Action ‘http://tempuri.org/addUser‘ cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1789)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2965)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:333)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at InterfaceUserTest.main(InterfaceUserTest.java:84)
{http://xml.apache.org/axis/}hostname:Rubert-PC
The message with Action ‘http://tempuri.org/addUser‘ cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1789)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2965)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:333)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at InterfaceUserTest.main(InterfaceUserTest.java:84)
-------------------------------------------------------------------------------------------------------------------------------------------------------------
报上面的错误一般都是URL,参数没配置好。
解决代码:
public static void main(String[] args) { String url = "http://tjgeo.cn:7101/OAService/idealUserService.svc?wsdl" ; String xmlData= get() ; Service service = new Service(); try { Call call2 = (Call) service.createCall(); call2.setTargetEndpointAddress(url); call2.setUseSOAPAction(true); call2.setReturnType(new QName("http://www.w3.org/2001/XMLSchema", "string"));//设置返回参数 call2.setOperationName(new QName("http://tempuri.org/", "addUser"));//设置函数名 call2.setSOAPActionURI("http://tempuri.org/IidealUserService/addUser");//设置URI call2.addParameter(new QName("http://tempuri.org/", "requestData"),XMLType.XSD_STRING, ParameterMode.IN); // 这里设置对应参数名称 String retVal2 = (String) call2.invoke(new Object[] { xmlData }); //调用并带上参数数据 System.out.println(retVal2); } catch(Exception e) { e.printStackTrace(); } } private static String get() { return "<?xml version=\"1.0\" encoding=\"UTF-8\"?> \r\n <serialId>46667888</serialId>\r\n<usermsg><user><uid>454545</uid><userName>张三</userName><employeeNumber>31001234</employeeNumber><title>总经理</title><email>abc@ njmetro.com.cn</email><employeeType>001</employeeType><sex>M</sex><pid>012345678912345</pid><mobilePhone1>18930416789</mobilePhone1><mobilePhone2>18930416789</mobilePhone2><tel>025-12345678</tel><fax>0987654</fax><location>办公室2105</location><homeAddress>南京101</homeAddress><homePhone>025-12345678</homePhone><qq>12345678</qq><msn>12345678</msn><org><orgName>浦东电信局|外高桥金桥分局|公众客户班</orgName><orgCode>55|5500|550001</orgCode><orderNum>1</orderNum></org></user></usermsg>"; }
<wsdl:definitions name="idealUserService" targetNamespace="http://tempuri.org/">
<wsdl:types><xsd:schema targetNamespace="http://tempuri.org/Imports"><xsd:import schemaLocation="http://tjgeo.cn:7102/OAService/idealUserService.svc?xsd=xsd0" namespace="http://tempuri.org/"/><xsd:import schemaLocation="http://tjgeo.cn:7102/OAService/idealUserService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/></xsd:schema></wsdl:types><wsdl:message name="IidealUserService_addUser_InputMessage"><wsdl:part name="parameters" element="tns:addUser"/></wsdl:message><wsdl:message name="IidealUserService_addUser_OutputMessage"><wsdl:part name="parameters" element="tns:addUserResponse"/></wsdl:message><wsdl:message name="IidealUserService_deleteUser_InputMessage"><wsdl:part name="parameters" element="tns:deleteUser"/></wsdl:message><wsdl:message name="IidealUserService_deleteUser_OutputMessage"><wsdl:part name="parameters" element="tns:deleteUserResponse"/></wsdl:message><wsdl:message name="IidealUserService_updateUser_InputMessage"><wsdl:part name="parameters" element="tns:updateUser"/></wsdl:message><wsdl:message name="IidealUserService_updateUser_OutputMessage"><wsdl:part name="parameters" element="tns:updateUserResponse"/></wsdl:message><wsdl:portType name="IidealUserService"><wsdl:operation name="addUser"><wsdl:input wsaw:Action="http://tempuri.org/IidealUserService/addUser" message="tns:IidealUserService_addUser_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IidealUserService/addUserResponse" message="tns:IidealUserService_addUser_OutputMessage"/></wsdl:operation><wsdl:operation name="deleteUser"><wsdl:input wsaw:Action="http://tempuri.org/IidealUserService/deleteUser" message="tns:IidealUserService_deleteUser_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IidealUserService/deleteUserResponse" message="tns:IidealUserService_deleteUser_OutputMessage"/></wsdl:operation><wsdl:operation name="updateUser"><wsdl:input wsaw:Action="http://tempuri.org/IidealUserService/updateUser" message="tns:IidealUserService_updateUser_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IidealUserService/updateUserResponse" message="tns:IidealUserService_updateUser_OutputMessage"/></wsdl:operation></wsdl:portType><wsdl:binding name="BasicHttpBinding_IidealUserService" type="tns:IidealUserService"><soap:binding transport="http://schemas.xmlsoap.org/soap/http"/><wsdl:operation name="addUser"><soap:operation soapAction="http://tempuri.org/IidealUserService/addUser" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="deleteUser"><soap:operation soapAction="http://tempuri.org/IidealUserService/deleteUser" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation><wsdl:operation name="updateUser"><soap:operation soapAction="http://tempuri.org/IidealUserService/updateUser" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation></wsdl:binding><wsdl:service name="idealUserService"><wsdl:port name="BasicHttpBinding_IidealUserService" binding="tns:BasicHttpBinding_IidealUserService"><soap:address location="http://tjgeo.cn:7102/OAService/idealUserService.svc"/></wsdl:port></wsdl:service></wsdl:definitions>
上面重要的信息都标成粉了,可以可以留意一下。
参考资料:
http://com-zyq.iteye.com/blog/2033602
http://blog.csdn.net/xw13106209/article/details/7067495
[Java - 调用WebService]{http://schemas.microsoft.com/ws/2005/05/addressing/none}ActionNotSupported
标签:
原文地址:http://www.cnblogs.com/royi123/p/5161350.html