wcf ksoap2标题修改

时间:2013-03-21 14:34:42

标签: java android wcf header ksoap2

此请求适用于WCF测试客户端(带有basichttpbinding的WCF Web服务)

    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
      <s:Header>
        <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://asp.net/ApplicationServices/v200/AuthenticationService/Login</Action>
      </s:Header>
      <s:Body>
        <Login xmlns="http://asp.net/ApplicationServices/v200">
          <username>USERNAME</username>
          <password>PASSWORD</password>
          <customCredential />
          <isPersistent>false</isPersistent>
        </Login>
      </s:Body>
    </s:Envelope>

这是java代码:

SoapObject request = new SoapObject(WS_NAMESPACE, WS_METHOD_NAME);      
request.addAttribute("username", username);
request.addAttribute("password", password);
request.addAttribute("customCredential", customCredential);

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(parameter);

HttpTransportSE httpTransport = new HttpTransportSE(WSDL_URL);  
        httpTransport.debug = true;

httpTransport.call(WS_NAMESPACE + WS_METHOD_NAME, envelope);

,这里是生成java代码的请求

    <v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">
        <v:Header />
        <v:Body>
            <Login xmlns="http://asp.net/ApplicationServices/v200/" id="o0" c:root="1" username="USERNAME" password="PASSWORD" customCredential="" />
        </v:Body>
    </v:Envelope>

我可以改变什么来获得第一个请求?

0 个答案:

没有答案