调用webservices异常处理:org.xml.sax.SAXException: 10C

org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
可能是我代码的问题,2个参数,最后要取两张数据表,应该怎么获取

现在有一个项目,调用sap发布到webservice的接口:









/s:sequence
/s:complexType
/s:element





/s:sequence
/s:complexType
/s:element
/s:sequence
/s:complexType
/s:element









/s:sequence
/s:complexType
/s:element





/s:sequence
/s:complexType
/s:element
/s:sequence
/s:complexType
/s:element
/s:schema
/wsdl:types

自己写的代码:
private String url="";//提供接口的地址

private String soapaction=""; //域名,这是在server定义的

 public HRPInfo()  
 {  
     String getDate="";
     String psw = "";
     Service service=new Service();  
     try{  
         Call call=(Call)service.createCall();              
         call.setTargetEndpointAddress(url);              
         call.setOperationName(new QName(soapaction,"Get_HR_RYKQ")); //设置要调用哪个方法  

         call.setEncodingStyle( null );
         call.setProperty( org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE );
         call.setProperty( org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE );
         call.setSOAPVersion( org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS );
         call.addParameter(new QName(soapaction,"inper"), //设置要传递的参数  
                 org.apache.axis.encoding.XMLType.XSD_STRING,  
                javax.xml.rpc.ParameterMode.IN);
         call.addParameter(new QName(soapaction,"psw"), //设置要传递的参数  
                 org.apache.axis.encoding.XMLType.XSD_STRING,  
                javax.xml.rpc.ParameterMode.IN);
         call.setReturnType(new QName(soapaction,"Get_HR_RYKQ","T_RYKQ"),Vector.class); //要返回的数据类型(自定义类型)  

         call.setUseSOAPAction(true);  
         call.setSOAPActionURI(soapaction + "Get_HR_RYKQ");      

         Vector v=(Vector)call.invoke(new Object[]{getDate,psw});//调用方法并传递参数          
         for(int i=0;i<v.size();i++)  
         {  
             System.out.println(v.get(i));  
         }              

     }catch(Exception ex)  
     {  
     ex.printStackTrace();  
     }          
 } 

5个回答

图片说明

call.setEncodingStyle( null );
call.setProperty( org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE );
call.setProperty( org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE );
call.setSOAPVersion( org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS );
call.addParameter(new QName(soapaction,"inper"), //设置要传递的参数

org.apache.axis.encoding.XMLType.XSD_STRING,

javax.xml.rpc.ParameterMode.IN);
call.addParameter(new QName(soapaction,"psw"), //设置要传递的参数

org.apache.axis.encoding.XMLType.XSD_STRING,

javax.xml.rpc.ParameterMode.IN);
call.setReturnType(new QName(soapaction,"Get_HR_RYKQ","T_RYKQ"),Vector.class); //要返回的数据类型(自定义类型)

建议楼主直接根据wsdl地址用eclipse生成一个客户端调用程序,这种生成的肯定可以用,如果客户端有压缩的过滤器如GZIP,那就需要先解压返回的包在调用客户端程序,都是爬过的坑···

ublic HRPInfo()

{

String getDate="";
String psw = "";
Service service=new Service();

try{

Call call=(Call)service.createCall();

call.setTargetEndpointAddress(url);

call.setOperationName(new QName(soapaction,"Get_HR_RYKQ")); //设置要调用哪个方法

     call.setEncodingStyle( null );
     call.setProperty( org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE );
     call.setProperty( org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE );
     call.setSOAPVersion( org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS );
     call.addParameter(new QName(soapaction,"inper"), //设置要传递的参数  
             org.apache.axis.encoding.XMLType.XSD_STRING,  
            javax.xml.rpc.ParameterMode.IN);
     call.addParameter(new QName(soapaction,"psw"), //设置要传递的参数  
             org.apache.axis.encoding.XMLType.XSD_STRING,  
            javax.xml.rpc.ParameterMode.IN);
     call.setReturnType(new QName(soapaction,"Get_HR_RYKQ","T_RYKQ"),Vector.class); //要返回的数据类型(自定义类型)  
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问