Quantcast
Channel: Question and Answer » web-services
Viewing all articles
Browse latest Browse all 136

Web Service Client – Changing SOAP-ENV: into soap:

$
0
0

This is reference to issue that I have with Web service client module, here is link to the previous issue:

https://www.drupal.org/node/2508926

Overall I’m trying to change the REQUEST from

POST /v3/PublicService.asmx HTTP/1.1
Host: api.tradera.com
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.6.8
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://api.tradera.com/GetOfficalTime"
Content-Length: 451
Authorization: Basic MTQ5OTo3ZjI5MTJmOC1lZjM2LTRkZTAtYWRmNS1kYjg4NWMxZTlkZjI=
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://api.tradera.com" xmlns:ns2="http://www.w3.org/2001/XMLSchema.xsd">
  <SOAP-ENV:Header>
    <ns2:Header>
      <AuthenticationHeader>
        <AppId>1502</AppId>
        <AppKey>965d0336-3fa3-4c11-ac9b-689f680d6482</AppKey>
      </AuthenticationHeader>
    </ns2:Header>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <ns1:GetOfficalTime/>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

to what I need which is:

POST /v3/publicservice.asmx HTTP/1.1
Host: api.tradera.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://api.tradera.com/GetOfficalTime"
<?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:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <AuthenticationHeader xmlns="http://api.tradera.com">
      <AppId>int</AppId>
      <AppKey>string</AppKey>
    </AuthenticationHeader>
    <ConfigurationHeader xmlns="http://api.tradera.com">
      <Sandbox>int</Sandbox>
      <MaxResultAge>int</MaxResultAge>
    </ConfigurationHeader>
  </soap:Header>
  <soap:Body>
    <GetOfficalTime xmlns="http://api.tradera.com" />
  </soap:Body>
</soap:Envelope>

And I tried to do that by extending the class in the module (it is my own website so I’m not worried about things breaking up after updating module)

you can see my failed attempt of it below:

<?php class XSoapClient extends WSClientEndpoint {
    public function __doRequest($request, $location, $action, $version, $one_way = null)
    {
        $request = preg_replace('/ns2:Header/','Header',$request, -1);  
        return parent::__doRequest($request, $location, $action, $version, $one_way);
    } } ?>

More informations about this issue is in the link above (I would really appriciate help)


Viewing all articles
Browse latest Browse all 136

Trending Articles