W
W
walke2017-10-02 13:08:57
Python
walke, 2017-10-02 13:08:57

SOAP request with extra tags, how to remove unnecessary ones?

Please help, I'm generating a simple soap request - it's generated with unnecessary lines, I can't get rid of them...

client = new SoapClient(null, array('location' => "address here",
                                     'uri'      => "uri here"));

 $sd1[]=array();
$sd2[]=array();
$sd3[]=array();

 $sd1[] = new SoapVar("*", XSD_STRING, null,null,"ORGANIZATIONCODE");
 $sd2[] = new SoapVar('ASSET', XSD_STRING, null,null,"EQUIPMENTCODE");
 $sd2[] = new SoapVar($sd1, SOAP_ENC_OBJECT, null,null,"ORGANIZATIONID");
 $sd3[] = new SoapVar($sd2, SOAP_ENC_OBJECT, null,null,"ASSETID");

try {
$result = $client->__soapCall("functuionname",$sd3);

At the output I get this:
<env:Envelope><env:Header>
    **header part here**
</env:Header>
<env:Body>
  <ns1:"functuionname", env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
  <param0 enc:itemType="xsd:anyType" enc:arraySize="0" xsi:type="enc:Array"/>   //Эта строка лишняя!!
    <ASSETID xsi:type="enc:Struct">
            <BOGUS enc:itemType="xsd:anyType" enc:arraySize="0" xsi:type="enc:Array"/>    //Эта строка лишняя!!
      <EQUIPMENTCODE xsi:type="xsd:string">ASSET</EQUIPMENTCODE>
      <ORGANIZATIONID xsi:type="enc:Struct">
        <BOGUS enc:itemType="xsd:anyType" enc:arraySize="0" xsi:type="enc:Array"/>    //Эта строка лишняя!!
        <ORGANIZATIONCODE xsi:type="xsd:string">*</ORGANIZATIONCODE>
      </ORGANIZATIONID>
    </ASSETID>
  </ns1:"functuionname">
</env:Body>
</env:Envelope>

How to get rid of extra lines?
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2019-06-23
@tuychiev1988

Each platform has nuances of use. In particular, on the free PythonAnywhere plan, you must use a proxy to access external resources. It's worth reading the documentation .

V
vyrkmod, 2017-10-02
@walke

I put my hat in

$sd1[]=array();
$sd2[]=array();
$sd3[]=array();

the square brackets are superfluous, it was supposed to simply declare three arrays, and not add an empty array to each of them. Well, the output, as I understand it, structurally corresponds to the input.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question