[Java - 调用WebService]{http://schemas.microsoft.com/ws/2005/05/addressing/none}ActionNotSupported

- 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>[email protected] 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

时间: 2024-10-21 09:19:09

[Java - 调用WebService]{http://schemas.microsoft.com/ws/2005/05/addressing/none}ActionNotSupported的相关文章

MVC5 A claim of type &#39;http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier&#39; or &#39;http://schemas.microsoft.com/accesscontrolservice/2

前台页面使用@Html.AntiForgeryToken()和Controller中的[ValidateAntiForgeryToken]配合使用可以防止CSRF攻击,详细介绍可查看一下链接: http://www.cnblogs.com/hyddd/archive/2009/04/09/1432744.html 出现当前错误,是因为在登陆完成为当前用户创建ClaimsIdentity对象时没有指定ClaimTypes,导致验证时不知道该用什么类型进行验证,或者验证类型不正确. 解决办法: 打开

Java调用WebService 接口 实例

这里给大家介绍一下,Java调用webservice的一个实例的过程. 本项目不能运行,因为接口地址不可用. 这里只是给大家介绍一个过程,同时留作自己的笔记.如果要学习,可以参照别人的实例.比较好. ①选择项目根目录的src ,右键,new --> webservice client 然后输入地址: http://172.18.100.52:456/hello?wsdl 必须要加wsdl结尾,这样才是一个webservice的接口. finlish.这时候刷新项目.可以看到项目下/src/com

Java调用WebService

Java调用WebService可以直接使用Apache提供的axis.jar自己编写代码,或者利用Eclipse自动生成WebService Client代码,利用其中的Proxy类进行调用.理论上是一样的,只不过用Eclipse自动生成代码省事些. 1.编写代码方式: package com.yudun.test; import java.rmi.RemoteException;import org.apache.axis.client.Call;import org.apache.axis

java调用webservice接口方法

webservice的 发布一般都是运用WSDL(web service descriptive language)文件的款式来发布的,在WSDL文件里边,包含这个webservice暴露在外面可供运用的接口.今日查找到了非常好的 webservice provider列表 http://www.webservicex.net/WCF/default.aspx 这上面列出了70多个包含许多方面的free webservice provider,utilities->global weather就

java调用webservice的四种方式

webservice: 就是应用程序之间跨语言的调用 wwww.webxml.com.cn 1.xml 2.    wsdl: webservice description language web服务描述语言 通过xml格式说明调用的地址方法如何调用,可以看错webservice的说明书 3.soap simple object access protoacl (简单对象访问协议) 限定了xml的格式 soap 在http(因为有请求体,所以必须是post请求)的基础上传输xml数据 请求和响

Java调用WebService的方法总结

1.使用命令wsimport自动生成java代码 wsimport是jdk自带的,可以根据wsdl文档生成客户端调用代码的工具.  wsimport.exe位于JAVA_HOME\bin目录下. 常用参数为: •-d<目录>  - 将生成.class文件.默认参数. •-s<目录> - 将生成.java文件. •-p<生成的新包名> -将生成的类,放于指定的包下. •(wsdlurl) - http://server:port/service?wsdl,必须的参数. 示

(转)java 调用webservice的各种方法总结

原文地址:http://www.blogjava.net/zjhiphop/archive/2009/04/29/webservice.html 现在webservice加xml技术已经逐渐成熟,但要真正要用起来还需时日!!    由于毕业设计缘故,我看了很多关于webservice方面的知识,今天和大家一起来研究研究webservice的各种使用方法.    一.利用jdk web服务api实现,这里使用基于 SOAP message 的 Web 服务     1.首先建立一个Web serv

java 调用webservice的各种方法总结

一.利用jdk web服务api实现,这里使用基于 SOAP message 的 Web 服务 1.首先建立一个Web services EndPoint: Java代码 package Hello; import javax.jws.WebService; import javax.jws.WebMethod; import javax.xml.ws.Endpoint; @WebService public class Hello { @WebMethod public String hell

Java调用WebService之Axis实现

import org.apache.axis.client.Call; import org.apache.axis.client.Service; /** * @ClassName: TestAxis * @Description: TODO(描述这个类的作用) * @author Roy_70 * @date 2017年4月18日 上午9:16:26 * */ public class TestAxis { public static void main(String []args){ St