问题描述
我用Axis2写的clint调用。netWCF开发的服务时报错,服务端本身没有问题一下是错误:log4j:WARNNoappenderscouldbefoundforlogger(org.apache.axis2.deployment.FileSystemConfigurator).log4j:WARNPleaseinitializethelog4jsystemproperly.1*********************[MessageContext:logID=urn:uuid:B35DA7955AD7EA6E4E1295269716165]2*********************nullorg.apache.axis2.AxisFault:Theserverdidnotrecognisetheactionwhichitreceived.atorg.apache.axis2.handlers.addressing.AddressingInFaultHandler.invoke(AddressingInFaultHandler.java:114)atorg.apache.axis2.engine.Phase.invoke(Phase.java:318)atorg.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:259)atorg.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:165)atorg.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:364)atorg.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)atorg.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)atorg.apache.axis2.client.OperationClient.execute(OperationClient.java:165)atorg.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:556)atorg.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:532)atTestClient.main(TestClient.java:103)JAVA代码如下:ConfigurationContextctx=ConfigurationContextFactory.createConfigurationContextFromFileSystem("./client-repo",null);ServiceClientsender=newServiceClient(ctx,null);Optionsoptions=newOptions();options.setTimeOutInMilliSeconds(600000L);options.setAction("TYKY.cMashup/2011/01/10/3.0/IPlatformServiceProvider/ValidateUser");options.setTo(TARGET_EPR);//options.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,Boolean.TRUE);options.setProperty(Configuration.MESSAGE_TYPE,"text/xml;charset=utf-8");options.setProperty(Configuration.CONTENT_TYPE,"text/xml;charset=utf-8");options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);options.setProperty(RampartMessageData.KEY_RAMPART_POLICY,loadPolicy("client-repo/policys/PlatfromServeive.xml"));options.setTimeOutInMilliSeconds(600000L);sender.setOptions(options);sender.engageModule("rampart");sender.engageModule("addressing");OMElementmethod=null;OMElementfromWriter=null;OMFactoryfactory=OMAbstractFactory.getOMFactory();OMNamespaceomNs=factory.createOMNamespace("TYKY.cMashup/2011/01/10/3.0/","xs");method=factory.createOMElement("ValidateUser",omNs);fromWriter=factory.createOMElement("token",omNs);fromWriter.addChild(factory.createOMText(fromWriter,"ssss"));method.addChild(fromWriter);OMElementresult=sender.sendReceive(method);System.out.println("sendTempMessage:"+result.getFirstElement().getText());一下是wsdl;<?xmlversion="1.0"encoding="utf-8"?>-<wsdl:definitionsname="PlatformServiceProvider"targetNamespace="http://tempuri.org/"xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"xmlns:tns="http://tempuri.org/"xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"xmlns:i0="TYKY.cMashup/2011/01/10/3.0"xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"xmlns:wsa10="http://www.w3.org/2005/08/addressing"xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex"xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">-<wsp:Policywsu:Id="WSHttpBinding_IPlatformServiceProvider_policy">-<wsp:ExactlyOne>-<wsp:All>-<wsrm:RMAssertionxmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"><wsrm:InactivityTimeoutMilliseconds="600000"/><wsrm:AcknowledgementIntervalMilliseconds="200"/></wsrm:RMAssertion><wsaw:UsingAddressing/></wsp:All></wsp:ExactlyOne></wsp:Policy><wsdl:importnamespace="TYKY.cMashup/2011/01/10/3.0"location="http://192.9.206.185:8888/PlatformServices.svc?wsdl=wsdl0"/><wsdl:types/>-<wsdl:bindingname="WSHttpBinding_IPlatformServiceProvider"type="i0:IPlatformServiceProvider"><wsp:PolicyReferenceURI="#WSHttpBinding_IPlatformServiceProvider_policy"/><soap12:bindingtransport="http://schemas.xmlsoap.org/soap/http"/>-<wsdl:operationname="ValidateUser"><soap12:operationsoapAction="TYKY.cMashup/2011/01/10/3.0/IPlatformServiceProvider/ValidateUser"style="document"/>-<wsdl:input><soap12:bodyuse="literal"/></wsdl:input>-<wsdl:output><soap12:bodyuse="literal"/></wsdl:output></wsdl:operation></wsdl:binding>-<wsdl:servicename="PlatformServiceProvider">-<wsdl:portname="WSHttpBinding_IPlatformServiceProvider"binding="tns:WSHttpBinding_IPlatformServiceProvider"><soap12:addresslocation="http://192.9.206.185:8888/PlatformServices.svc"/>-<wsa10:EndpointReference><wsa10:Address>http://192.9.206.185:8888/PlatformServices.svc</wsa10:Address></wsa10:EndpointReference></wsdl:port></wsdl:service></wsdl:definitions>哪位高手帮忙看看,万分感谢
解决方案
解决方案二:
把配置文件中的WSHttpBinding改成basicHttpBinding就可以啦!