1

My SOAP Request

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://ws.dgpys.deloitte.com" xmlns:ns2="ws.apache.org/namespaces/axis2">
    <env:Header>
        <ns2:ServiceGroupId>
            <BOGUS>urn:uuid:7C2F61BDE7CB9D9C6D1424938568724</BOGUS>
        </ns2:ServiceGroupId>
    </env:Header>
    <env:Body>
        <ns1:getGunlukParametreRapor>
            <date>2015-02-22T00:00Z</date>
        </ns1:getGunlukParametreRapor>
    </env:Body>
</env:Envelope>

Expected SOAP Request

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ws="http://ws.dgpys.deloitte.com">
   <soap:Header>
       <axis2:ServiceGroupId xmlns:axis2="http://ws.apache.org/namespaces/axis2">urn:uuid:479731898147E116AD1424691518968</axis2:ServiceGroupId>
   </soap:Header>
   <soap:Body>
      <ws:getGunlukParametreRapor>
         <date>2015-02-22T00:00Z</date>
      </ws:getGunlukParametreRapor>
   </soap:Body>
</soap:Envelope>

Tried with following codes:

$options = array(
        'trace'       => 1,
        'exceptions'  => 1,
        'soap_version' => SOAP_1_2
    );
$client = new SoapClient("http://dgpysws.pmum.gov.tr/dgpys/services/EVDServis.wsdl", $options);

$p1 = new stdCLass();
$p1->loginMessage = new stdCLass();
$p1->loginMessage->UserName = new stdCLass();
$p1->loginMessage->UserName->v = "Username";
$p1->loginMessage->Password = new stdCLass();
$p1->loginMessage->Password->v = "Passwor";
$client->login($p1);

$headers[] = new SoapHeader('http//ws.apache.org/namespaces/axis2', 'ServiceGroupId', "UNIQUEID", false);
$client->__setSoapHeaders($headers);    
$result = $client->getGunlukParametreRapor(array('date' => '2015-02-22T00:00Z'));

Question is:

  1. These SOAP requests are same?

I'm using SOAP_1_2 and it should be like Expected SOAP Request but my request doesnt looks like to expected format. Missing where?

  1. How can i get the output like as expected?

Note: dgpysws.pmum.gov.tr wsdl address is private area.

Bora
  • 10,529
  • 5
  • 43
  • 73
  • I used pmum webservice 2 years before. I couldn't get response from php or java. I used these webservice by using c#. – Muhammed Tanriverdi Feb 27 '15 at 12:51
  • exa.= stringBuilder2.Append(""); stringBuilder2.Append(""); stringBuilder2.Append("urn:uuid:"); stringBuilder2.Append(sessionId); stringBuilder2.Append(""); stringBuilder2.Append(""); stringBuilder2.Append(""); stringBuilder2.Append(""); – Muhammed Tanriverdi Feb 27 '15 at 12:53
  • @MuhammedTanrıverdi OMG! It is bad, so bad news for me! This `exa` what for, C#? I can login `PMUM` but when i try to get data, i got `Authorization error!` error allways. I think this issue about `xml tags`. I couldnt get output like expected with `axis2` and `ws` tag. Thanks Muhammed for helps. – Bora Feb 27 '15 at 13:07
  • Yes its for C# code. You should write each soap code by yourself. And you can contact to person who work in PMUM. I think they would help you. Because my system could not get response from PMUM with old webservice in 2015. I do not know, maybe my account expired or their webservice could be changed. It is better to ask them. Kolay gelsin :) – Muhammed Tanriverdi Feb 27 '15 at 13:13
  • @MuhammedTanrıverdi I contact with a person who worked in pmum but not much help. I'm trying to convert xml tags to `axis2` format. I searched, searched, searched on everwhere but not found any solution. Eywallah ;) – Bora Feb 27 '15 at 13:33
  • I can not write the email here who was the responsible person :) But I found a webpage, you can contact with this email. https://gunce.pmum.gov.tr/?p=239 – Muhammed Tanriverdi Feb 27 '15 at 13:37
  • @Bora why don't you post your php code? – Alex Mar 02 '15 at 14:35
  • @Alex Updated question with php codes. – Bora Mar 02 '15 at 16:45

3 Answers3

2

They are not the same. To get rid of the BOGUS node you need to use this:

$strHeaderComponent_Session = "<SessionHeader><ServiceGroupId>$theVarWithTheIDGoesHere</ServiceGroupId></SessionHeader>";
$objVar_Session_Inside = new SoapVar($strHeaderComponent_Session, XSD_ANYXML,
                                     null, null, null);
$objHeader_Session_Outside = new SoapHeader('http//ws.apache.org/namespaces/axis2', 
                                           'SessionHeader', $objVar_Session_Inside);

// More than one header can be provided in this array.
$client->__setSoapHeaders(array($objHeader_Session_Outside));
Francisco Félix
  • 2,413
  • 13
  • 16
1

try the following

$ns = 'http//ws.apache.org/namespaces/axis2'; //Namespace of the WS.
//Body of the Soap Header.
$headerbody = array('ServiceGroupId' => $UNIQUEID_Token);
//Create Soap Header.       
$header = new SOAPHeader($ns, 'axis2', $headerbody);             
//set the Headers of Soap Client.
$soap_client->__setSoapHeaders($header); 
1
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://ws.dgpys.deloitte.com" xmlns:ns2="ws.apache.org/namespaces/axis2">
    <env:Header>
        <ns2:ServiceGroupId>
            urn:uuid:7C2F61BDE7CB9D9C6D1424938568724
        </ns2:ServiceGroupId>
    </env:Header>
    <env:Body>
        <ns1:getGunlukParametreRapor>
            <date>2015-02-22T00:00Z</date>
        </ns1:getGunlukParametreRapor>
    </env:Body>
</env:Envelope>

And

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ws="http://ws.dgpys.deloitte.com">
   <soap:Header>
       <axis2:ServiceGroupId xmlns:axis2="http://ws.apache.org/namespaces/axis2">urn:uuid:479731898147E116AD1424691518968</axis2:ServiceGroupId>
   </soap:Header>
   <soap:Body>
      <ws:getGunlukParametreRapor>
         <date>2015-02-22T00:00Z</date>
      </ws:getGunlukParametreRapor>
   </soap:Body>
</soap:Envelope>

Are the same. env=soap, ns2=ws and ns2=axis2. You can have any prefix to refer to these namespaces as you like. Once you assign the prefix you just refer to it using that in the other places. Only diff was the bogus tag tin first request. Just remove that.