本人计划调用   超链接 http://210.43.64.106/Service.asmx 这个地址的一个接口   XSCheckPassword(String strXH,String strPassword)  但是用axis2 和 axis1 都试过了 就是出现异常 ,还请高手指教调用代码如下:package com.tools;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.soap.SOAP11Constants;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axis2.transport.http.HttpTransportProperties.ProxyProperties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class CheckPassword {
             
private static EndpointReference targetEPR2 = 
new  EndpointReference("http://210.43.64.106/Service.asmx");public void  getResult() throws Exception
    {
            String s = null;
         ServiceClient  sender =  new  ServiceClient();           
        sender.setOptions(buildOptions());
        OMElement  result  = sender.sendReceive(buildParam());
        System.out.println(result);
        s  = result.getFirstElement().getText();
        System.out.println(s);              
    }          
   
            private static OMElement buildParam()
    {
        OMFactory    fac = OMAbstractFactory.getOMFactory();
        OMNamespace  omNs = fac.createOMNamespace("http://tempuri.org/", "");
                           
        OMElement   data =fac.createOMElement("XSCheckPassword", omNs);                   
        OMElement inner1 = fac.createOMElement("strXH",omNs);
        OMElement inner2 = fac.createOMElement("strPassword",omNs);
        inner1.setText("20084042034");  
        inner2.setText("2008198821");
        
        data.addChild(inner1);    
        data.addChild(inner2);  
        return   data;
    }
        
    private static Options buildOptions()
    {
        Options options = new Options();
        options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
        options.setAction("http://www.zf_webservice.com/XSCheckPassword");              
        options.setTo(targetEPR2);
        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
        return options;
    }
    
    public static void main(String[] args) throws Exception
    {
         CheckPassword s = new CheckPassword();
         s.getResult();
    }
}异常如下:log4j:WARN No appenders could be found for logger (org.apache.axis2.util.Loader).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.apache.axis2.AxisFault: 服务器无法读取请求。 --> XML 文档(1, 130)中有错误。 --> 不应有 <XSCheckPassword xmlns='http://tempuri.org/'>。
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:512)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:548)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:528)
at com.tools.CheckPassword.getResult(CheckPassword.java:25)
at com.tools.CheckPassword.main(CheckPassword.java:60)本人测试很多遍了,还请高手指教   感激不尽  到时候还可以追加分数  只要解决问题。

解决方案 »

  1.   

    Exception in thread "main" org.apache.axis2.AxisFault: 服务器无法读取请求。 -->  XML 文档(1, 130)中有错误。 --> 不应有 <XSCheckPassword xmlns='http://tempuri.org/'>。说的挺明白的。
      

  2.   


    XSCheckPassword
    XSCheckPassword(ByVal strXH As String, ByVal strPassword As String) As Integer测试
    测试窗体只能用于来自本地计算机的请求。 
    SOAP
    下面是一个 SOAP 请求和响应示例。所显示的占位符需要由实际值替换。POST /Service.asmx HTTP/1.1
    Host: 210.43.64.106
    Content-Type: text/xml; charset=utf-8
    Content-Length: length
    SOAPAction: "http://www.zf_webservice.com/XSCheckPassword"<?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/" xmlns:types="http://tempuri.org/encodedTypes" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        <q1:XSCheckPassword xmlns:q1="http://www.zf_webservice.com/XSCheckPassword">
          <strXH xsi:type="xsd:string">string</strXH>
          <strPassword xsi:type="xsd:string">string</strPassword>
        </q1:XSCheckPassword>
      </soap:Body>
    </soap:Envelope>
    HTTP/1.1 200 OK
    Content-Type: text/xml; charset=utf-8
    Content-Length: length<?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/" xmlns:types="http://tempuri.org/encodedTypes" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        <q2:XSCheckPasswordResponse xmlns:q2="http://www.zf_webservice.com/XSCheckPassword">
          <XSCheckPasswordResult xsi:type="xsd:int">int</XSCheckPasswordResult>
        </q2:XSCheckPasswordResponse>
      </soap:Body>
    </soap:Envelope>
      

  3.   

      <?xml version="1.0" encoding="utf-8" ?> 
    - <wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
    - <wsdl:types>
    - <s:schema targetNamespace="http://tempuri.org/">
      <s:import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> 
      <s:import namespace="http://schemas.xmlsoap.org/wsdl/" /> 
    - <s:complexType name="ArrayOfString">
    - <s:complexContent mixed="false">
    - <s:restriction base="soapenc:Array">
      <s:attribute wsdl:arrayType="s:string[]" ref="soapenc:arrayType" /> 
      </s:restriction>
      </s:complexContent>
      </s:complexType>- <wsdl:message name="XSCheckPasswordSoapIn">
      <wsdl:part name="strXH" type="s:string" /> 
      <wsdl:part name="strPassword" type="s:string" /> 
      </wsdl:message>
    - <wsdl:message name="XSCheckPasswordSoapOut">
      <wsdl:part name="XSCheckPasswordResult" type="s:int" /> 
      </wsdl:message>
    - <wsdl:operation name="XSCheckPassword">
      <documentation xmlns="http://schemas.xmlsoap.org/wsdl/">XSCheckPassword(ByVal strXH As String, ByVal strPassword As String) As Integer</documentation> 
      <wsdl:input message="tns:XSCheckPasswordSoapIn" /> 
      <wsdl:output message="tns:XSCheckPasswordSoapOut" /> 
      </wsdl:operation>
    - <wsdl:operation name="XSCheckPassword">
      <soap:operation soapAction="http://www.zf_webservice.com/XSCheckPassword" style="rpc" /> 
    - <wsdl:input>
      <soap:body use="encoded" namespace="http://www.zf_webservice.com/XSCheckPassword" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> 
      </wsdl:input>
    - <wsdl:output>
      <soap:body use="encoded" namespace="http://www.zf_webservice.com/XSCheckPassword" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> 
      </wsdl:output>
      </wsdl:operation>
    我剪切了一些信息  请帮我看一下
      

  4.   

    XSCheckPassword xmlns='http://tempuri.org/没发现这个啊
      

  5.   

    不行的话把XSCheckPassword xmlns='http://tempuri.org/的xmlns='http://tempuri.org/删了试试。
      

  6.   


    这个webservice服务器不是我开放的  我现在只是用别人地,呵呵。现在如果要得到
    OMNamespace  omNs = fac.createOMNamespace("http://tempuri.org/", "");
    就要一个命名空间。         
            
      

  7.   


    这个明显是你自己生成的xml,然后将xml发送给webservice的。
      

  8.   

    OMNamespace  omNs = fac.createOMNamespace("http://tempuri.org/", "");
    看看不生成namespace试试。
      

  9.   

    namespace的问题,把它去了试试
      

  10.   


    我感觉 <q2:XSCheckPasswordResponse xmlns:q2="http://www.zf_webservice.com/XSCheckPassword">
    这句话有问题  一般的就是
     <XSCheckPasswordResponse xmlns:="http://www.zf_webservice.com/XSCheckPassword">没有那个q2  那个q2让人感觉难受
      

  11.   


    用想fire倒是没有用过