0

I send request to web service: how to add one attribute to envelope object some method to add, probe of methods, but none work, I thought prefixes were added by the Envelope, add the tag

Add envelope object and Add header with Elements

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;

This is request estructure, this send to web service

  <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>

I need add attribute to tag :

  <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>
Mark Dev
  • 151
  • 1
  • 6

0 Answers0