博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
用Java axis2调用.net平台的Webservice出现的一些问题
阅读量:6593 次
发布时间:2019-06-24

本文共 13565 字,大约阅读时间需要 45 分钟。

问题1:

AxisFault faultCode: {http://schemas.microsoft.com/ws/2005/05/addressing/none}ActionNotSupported faultSubcode:  faultString: The message with Action '' 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 '' 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:221)    at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)    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:424)    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:2765)    at org.apache.axis.client.Call.invoke(Call.java:2748)    at org.apache.axis.client.Call.invoke(Call.java:2424)    at org.apache.axis.client.Call.invoke(Call.java:2347)    at org.apache.axis.client.Call.invoke(Call.java:1804)    at InterfaceUserTest.main(InterfaceUserTest.java:41)    {http://xml.apache.org/axis/}hostname:Rubert-PCThe message with Action '' 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:221)    at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)    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:424)    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:2765)    at org.apache.axis.client.Call.invoke(Call.java:2748)    at org.apache.axis.client.Call.invoke(Call.java:2424)    at org.apache.axis.client.Call.invoke(Call.java:2347)    at org.apache.axis.client.Call.invoke(Call.java:1804)    at InterfaceUserTest.main(InterfaceUserTest.java:41)

问题2:

AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client faultSubcode:  faultString: The methods deleteUser and addUser use the same SOAPAction 'http://tempuri.org/WelcomeTxt'. When the RoutingStyle of the XML Web service is SoapAction, SOAPAction values must be unique across methods on the XML Web service. You can change the SOAPAction with the Action parameter to the SoapDocumentMethod or SoapRpcMethod attributes, or you can specify a RoutingStyle of RequestElement on the XML Web service. faultActor:  faultNode:  faultDetail:     {http://xml.apache.org/axis/}stackTrace:The methods deleteUser and addUser use the same SOAPAction 'http://tempuri.org/WelcomeTxt'. When the RoutingStyle of the XML Web service is SoapAction, SOAPAction values must be unique across methods on the XML Web service. You can change the SOAPAction with the Action parameter to the SoapDocumentMethod or SoapRpcMethod attributes, or you can specify a RoutingStyle of RequestElement on the XML Web service.    at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)    at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)    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:424)    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:2765)    at org.apache.axis.client.Call.invoke(Call.java:2748)    at org.apache.axis.client.Call.invoke(Call.java:2424)    at org.apache.axis.client.Call.invoke(Call.java:2347)    at org.apache.axis.client.Call.invoke(Call.java:1804)    at InterfaceUserTest.main(InterfaceUserTest.java:42)    {http://xml.apache.org/axis/}hostname:Rubert-PCThe methods deleteUser and addUser use the same SOAPAction 'http://tempuri.org/WelcomeTxt'. When the RoutingStyle of the XML Web service is SoapAction, SOAPAction values must be unique across methods on the XML Web service. You can change the SOAPAction with the Action parameter to the SoapDocumentMethod or SoapRpcMethod attributes, or you can specify a RoutingStyle of RequestElement on the XML Web service.    at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)    at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)    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:424)    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:2765)    at org.apache.axis.client.Call.invoke(Call.java:2748)    at org.apache.axis.client.Call.invoke(Call.java:2424)    at org.apache.axis.client.Call.invoke(Call.java:2347)    at org.apache.axis.client.Call.invoke(Call.java:1804)    at InterfaceUserTest.main(InterfaceUserTest.java:42)

问题是加上各种头和返回参数即可,如下代码:

1 public static void main(String[] args) { 2         String url = "http://localhost:7102/OAService/idealUserService.svc?wsdl"; 3         String xmlData= get(); 4          5         Service service = new Service(); 6         try { 7             Call call2 = (Call) service.createCall();   8             call2.setTargetEndpointAddress(url);   9             call2.setUseSOAPAction(true);  10             call2.setReturnType(new QName("http://www.w3.org/2001/XMLSchema",  "string"));//设置返回参数类型 11             call2.setOperationName(new QName("http://tempuri.org/", "addUser"));//设置函数名  12             call2.setSOAPActionURI("http://tempuri.org/IidealUserService/addUser");//设置URI13             call2.addParameter(new QName("http://tempuri.org/", "requestData"),XMLType.XSD_STRING, ParameterMode.IN);  // 这里设置对应参数名称  14             String retVal2 = (String) call2.invoke(new Object[] { xmlData });  //调用并带上参数数据15             System.out.println(retVal2); 16         } catch(Exception e) {17             e.printStackTrace();18         }19     }20     21     22     private static String get() {23         String s =  "xxxxxxsxx";24         return s;25     }

 

转载于:https://www.cnblogs.com/royi123/p/5179249.html

你可能感兴趣的文章
Sql语句-case when then else end
查看>>
Python_编程特色
查看>>
ant打jar包
查看>>
【Android】The application has stopped unexpectedly.Please try again.
查看>>
为什么要使用Ajax
查看>>
java web开发使用伪静态
查看>>
CISCO交换机密码恢复
查看>>
我的友情链接
查看>>
有关在linux 下跑asp.net文章博客
查看>>
Linux/Unix的精巧约定两例及其简析:目录权限和文本行数
查看>>
WebDAV助手1.1.0更新
查看>>
[CTSC2018]青蕈领主
查看>>
原型继承
查看>>
找不到ifconfig命令
查看>>
微服务事务处理
查看>>
用Groovy进行单元测试
查看>>
github地址
查看>>
nginx使用
查看>>
两个openssh间免密码登录
查看>>
【linux】 linux gpio操作
查看>>