调用客户端代码public AuthResponse authRequest(AuthRequest authReq)
{
endpoint = authReq.getServicePath();
AuthResponse authRes = new AuthResponse();
try
{
Call call = (Call)cmsService.createCall();
QName qnReq = new QName("urn:BeanService", "AuthRequest");
Class clsReq = com.huawei.mdn.um.sms.unify.AuthRequest.class;
call.registerTypeMapping(clsReq, qnReq, new BeanSerializerFactory(clsReq, qnReq), new BeanDeserializerFactory(clsReq, qnReq));
QName qnRes = new QName("urn:BeanService", "AuthResponse");
Class clsRes = com.huawei.mdn.um.sms.unify.AuthResponse.class;
call.registerTypeMapping(clsRes, qnRes, new BeanSerializerFactory(clsRes, qnRes), new BeanDeserializerFactory(clsRes, qnRes));
call.setTargetEndpointAddress(new URL(endpoint));
call.setOperationName("authRequest");
authRes = (AuthResponse)call.invoke(new Object[] {
authReq
});
}
catch(ServiceException e1)
{
e1.printStackTrace();
System.err.println(e1.toString());
}
catch(RemoteException e)
{
e.printStackTrace();
}
catch(MalformedURLException e)
{
e.printStackTrace();
}
return authRes;
}出错信息
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:145)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:345)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.thirdparty.bss.NotifyClient.authRequest(NotifyClient.java:45)
at test.com.thirdparty.bss.NotifyClient_Test.test(NotifyClient_Test.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) {http://xml.apache.org/axis/}hostname:luofengboyorg.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
at org.apache.axis.client.Call.invoke(Call.java:2470)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.thirdparty.bss.NotifyClient.authRequest(NotifyClient.java:45)
at test.com.thirdparty.bss.NotifyClient_Test.test(NotifyClient_Test.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:145)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:345)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
... 22 more
{
endpoint = authReq.getServicePath();
AuthResponse authRes = new AuthResponse();
try
{
Call call = (Call)cmsService.createCall();
QName qnReq = new QName("urn:BeanService", "AuthRequest");
Class clsReq = com.huawei.mdn.um.sms.unify.AuthRequest.class;
call.registerTypeMapping(clsReq, qnReq, new BeanSerializerFactory(clsReq, qnReq), new BeanDeserializerFactory(clsReq, qnReq));
QName qnRes = new QName("urn:BeanService", "AuthResponse");
Class clsRes = com.huawei.mdn.um.sms.unify.AuthResponse.class;
call.registerTypeMapping(clsRes, qnRes, new BeanSerializerFactory(clsRes, qnRes), new BeanDeserializerFactory(clsRes, qnRes));
call.setTargetEndpointAddress(new URL(endpoint));
call.setOperationName("authRequest");
authRes = (AuthResponse)call.invoke(new Object[] {
authReq
});
}
catch(ServiceException e1)
{
e1.printStackTrace();
System.err.println(e1.toString());
}
catch(RemoteException e)
{
e.printStackTrace();
}
catch(MalformedURLException e)
{
e.printStackTrace();
}
return authRes;
}出错信息
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:145)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:345)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.thirdparty.bss.NotifyClient.authRequest(NotifyClient.java:45)
at test.com.thirdparty.bss.NotifyClient_Test.test(NotifyClient_Test.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) {http://xml.apache.org/axis/}hostname:luofengboyorg.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
at org.apache.axis.client.Call.invoke(Call.java:2470)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.thirdparty.bss.NotifyClient.authRequest(NotifyClient.java:45)
at test.com.thirdparty.bss.NotifyClient_Test.test(NotifyClient_Test.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:145)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:345)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
... 22 more
解决方案 »
- 求高手解答SQL问题,满分送上!!!
- 如何在一个页面捕捉alert告警框,并confirm掉?
- 请教大虾:如何在struts2中实现datasource的方式访问mysql数据库
- struts1.1的问题
- 菜鸟再线等待
- servlet forward sendRedirect怎么都不跳转和冲定向?
- 有什么可以取字符的ascii码函数啊?和ascii转为字符啊??
- 我用Struts做了个留言板,可是连接数据库总是出问题。谢谢了
- 我想把java程序做成windows服务
- tomcat基本配置问题.
- 关于EXT TREENODE BEFOREEXPAND问题
- com.ibatis.common.jdbc.exception.NestedSQLException:
<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<globalConfiguration>
<parameter name="sendMultiRefs" value="true"/>
<parameter name="disablePrettyXML" value="true"/>
<parameter name="adminPassword" value="admin"/>
<parameter name="attachments.Directory" value="D:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\WebServices\WEB-INF\attachments"/>
<parameter name="dotNetSoapEncFix" value="true"/>
<parameter name="enableNamespacePrefixOptimization" value="false"/>
<parameter name="sendXMLDeclaration" value="true"/>
<parameter name="sendXsiTypes" value="true"/>
<parameter name="attachments.implementation" value="org.apache.axis.attachments.AttachmentsImpl"/>
<requestFlow>
<handler type="java:org.apache.axis.handlers.JWSHandler">
<parameter name="scope" value="session"/>
</handler>
<handler type="java:org.apache.axis.handlers.JWSHandler">
<parameter name="scope" value="request"/>
<parameter name="extension" value=".jwr"/>
</handler>
</requestFlow>
</globalConfiguration>
<handler name="LocalResponder" type="java:org.apache.axis.transport.local.LocalResponder"/>
<handler name="URLMapper" type="java:org.apache.axis.handlers.http.URLMapper"/>
<handler name="Authenticate" type="java:org.apache.axis.handlers.SimpleAuthenticationHandler"/>
<service name="UnfiyAPIImpl" provider="java:RPC" style="wrapped" use="literal">
<parameter name="wsdlTargetNamespace" value="http://unify.sms.um.mdn.huawei.com"/>
<parameter name="wsdlServiceElement" value="UnfiyAPIImplService"/>
<parameter name="schemaQualified" value="http://unify.sms.um.mdn.huawei.com"/>
<parameter name="wsdlServicePort" value="UnfiyAPIImpl"/>
<parameter name="className" value="com.huawei.mdn.um.sms.unify.UnfiyAPIImpl"/>
<parameter name="wsdlPortType" value="UnfiyAPIImpl"/>
<parameter name="typeMappingVersion" value="1.2"/>
<operation xmlns:operNS="http://unify.sms.um.mdn.huawei.com" xmlns:retNS="http://unify.sms.um.mdn.huawei.com" xmlns:rtns="http://unify.sms.um.mdn.huawei.com" name="authRequest" qname="operNS:authRequest" returnQName="retNS:authRequestReturn" returnType="rtns:AuthResponse" soapAction="">
<parameter xmlns:pns="http://unify.sms.um.mdn.huawei.com" xmlns:tns="http://unify.sms.um.mdn.huawei.com" qname="pns:authReq" type="tns:AuthRequest"/>
</operation>
<operation xmlns:operNS="http://unify.sms.um.mdn.huawei.com" xmlns:retNS="http://unify.sms.um.mdn.huawei.com" xmlns:rtns="http://unify.sms.um.mdn.huawei.com" name="accountRequest" qname="operNS:accountRequest" returnQName="retNS:accountRequestReturn" returnType="rtns:AccountResponse" soapAction="">
<parameter xmlns:pns="http://unify.sms.um.mdn.huawei.com" xmlns:tns="http://unify.sms.um.mdn.huawei.com" qname="pns:accReq" type="tns:AccountRequest"/>
</operation>
<parameter name="allowedMethods" value="accountRequest authRequest"/> <typeMapping xmlns:ns="http://unify.sms.um.mdn.huawei.com" qname="ns:AuthResponse" type="java:com.huawei.mdn.um.sms.unify.AuthResponse" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle=""/>
<typeMapping xmlns:ns="http://unify.sms.um.mdn.huawei.com" qname="ns:AccountRequest" type="java:com.huawei.mdn.um.sms.unify.AccountRequest" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle=""/>
<typeMapping xmlns:ns="http://unify.sms.um.mdn.huawei.com" qname="ns:AccountResponse" type="java:com.huawei.mdn.um.sms.unify.AccountResponse" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle=""/>
<typeMapping xmlns:ns="http://unify.sms.um.mdn.huawei.com" qname="ns:AuthRequest" type="java:com.huawei.mdn.um.sms.unify.AuthRequest" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle=""/>
</service>
<transport name="http">
<requestFlow>
<handler type="URLMapper"/>
<handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
</requestFlow>
<parameter name="qs:list" value="org.apache.axis.transport.http.QSListHandler"/>
<parameter name="qs:wsdl" value="org.apache.axis.transport.http.QSWSDLHandler"/>
<parameter name="qs.list" value="org.apache.axis.transport.http.QSListHandler"/>
<parameter name="qs.method" value="org.apache.axis.transport.http.QSMethodHandler"/>
<parameter name="qs:method" value="org.apache.axis.transport.http.QSMethodHandler"/>
<parameter name="qs.wsdl" value="org.apache.axis.transport.http.QSWSDLHandler"/>
</transport>
<transport name="local">
<responseFlow>
<handler type="LocalResponder"/>
</responseFlow>
</transport>
</deployment>
{
private String transID; private int resultCode; //操作结果,0表示成功,非0表示失败。
private int accountAction;
private String description; //返回信息
private String signData; //签名信息。其中用于数字签名算法的“接口通讯请求数据”为: public AuthResponse()
{
accountAction = -1;
description = "";
resultCode = -1;
signData = "";
transID = "";
}
public void setTransID(String transID)
{
this.transID = transID;
}
public String getTransID()
{
return this.transID;
}
public void setResultCode(int resultCode)
{
this.resultCode = resultCode;
}
public int getResultCode()
{
return this.resultCode;
}
public void setAccountAction(int accountAction)
{
this.accountAction = accountAction;
}
public int getAccountAction()
{
return this.accountAction;
}
public void setDescription(String description)
{
this.description = description;
}
public String getDescription()
{
return this.description;
}
public void setSignData(String signData)
{
this.signData = signData;
}
public String getSignData()
{
return this.signData;
}
public String toString()
{
StringBuffer tmpSb = new StringBuffer();
tmpSb.append("\n>>>>AuthResponse");
tmpSb.append("\nTransID = ").append(this.transID);
tmpSb.append("\nResultCode = ").append(this.resultCode);
tmpSb.append("\nAccountAction = ").append(this.accountAction);
tmpSb.append("\nDescription = ").append(this.description);
tmpSb.append("\nSignData = ").append(this.signData);
tmpSb.append("\nAuthResponse<<<<");
return tmpSb.toString();
}
}
我也碰到同样的问题
能把解决方法告诉我吗
[email protected]
我也碰到同样的问题
能把解决方法告诉我吗
[email protected]
谢谢
[email protected]
[email protected]
1.所有类名首字母强制大写
2.所有方法名首字母强制小写! 字母大小写错误会导致调用webservice时报异常SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize