添加属性soapserializationenvelope?

时间:2016-06-23 04:18:27

标签: android web-services soap attributes

我向网络服务发送请求: 如何将一个属性添加到信封对象 一些方法添加,方法探测,但没有工作,我认为前缀是由信封添加,添加标签

添加信封对象并使用元素添加标题

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
request.addProperty("sID", user);

Element[] header = new Element[1];
header[0] = new Element().createElement(NAMESPACE, "credendtials" );
Element tagUser = new Element().createElement(null, "UserName");
tagUser.addChild(Node.TEXT, valUSER);
header[0].addChild(Node.ELEMENT, tagUser);
Element tagPass = new Element().createElement(null, "UserPassword");
tagPass.addChild(Node.TEXT, valPASS);
header[0].addChild(Node.ELEMENT, tagPass);
envelope.implicitTypes = true;
envelope.setAddAdornments(false);
envelope.dotNet = false;
envelope.headerOut = header;
envelope.setOutputSoapObject(request);
HttpTransportSE transporte = new HttpTransportSE(URL);
transporte.debug = true;

这是请求estructure,这是发送到Web服务

  <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>
       <n0:Credentials  xmlns:n0="http://254.254.254.254:9999">
          <UserName></UserName>
          <UserPassword></UserPassword>
       </n0:Credentials>
    </v:Header>
   <v:Body>
   <Emp xmlns="http://254.254.254.254:9999">
     <sID></sID>
   </Emp>
 </v:Body>
</v:Envelope>

我需要为标记添加属性:

  <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/"
  xmlns="http://254.254.254.254:9999">
    <v:Header>
       <n0:Credentials xmlns:n0="http://254.254.254.254:9999">
          <UserName></UserName>
          <UserPassword></UserPassword>
       </n0:Credentials>
    </v:Header>
   <v:Body>
   <Emp xmlns="http://254.254.254.254:9999">
     <sID></sID>
   </Emp>
 </v:Body>
</v:Envelope>

0 个答案:

没有答案