Jump to content

SOAP headers


danik69

Recommended Posts

Hello

 

I have looked all over for an answer but so far have had no luck in finding one so hopefully someone can help me here.

 

I am using SOAP to connect to a CRM api. So here is my code below

<?php
//Connect To WebCrm API
$client = new SoapClient("API addressl");

$result = $client->Authenticate(array('dbnCode' => 'jgljjldfjfljgljdl','userName' =>'blafahah','password' =>'hfhgfhfhgfg'));


//This is just out putting the response
var_dump($result);


 

This is the dump of the response i get

 

object(stdClass)#2 (1) { ["AuthenticateResult"]=> object(stdClass)#3 (2) { ["Message"]=> string(0) "" ["Code"]=> int(0) } }

 

This is fine and I can access the values and do what i want with them however I need access to the SOAP header and have no idea how i get access to this?

 

Below is the soap request and response using the api test

 

SOAP REQUEST

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope 
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <Authenticate xmlns="CRM/">
      <dbnCode>fhdhhdhddfhd</dbnCode>
      <userName>dhdfdhd</userName>
      <password>dhdhhf</password>
    </Authenticate>
  </soap12:Body>
</soap12:Envelope>

 

SOAP response

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <TicketHeader xmlns="CRM">
      <Guid>I NEED TO GET ACCESS TO THIS</Guid>
    </TicketHeader>
  </soap:Header>
  <soap:Body>
    <AuthenticateResponse xmlns="CRM">
      <AuthenticateResult>
        <Message />
        <Code>0</Code>
      </AuthenticateResult>
    </AuthenticateResponse>
  </soap:Body>
</soap:Envelope>

 

as you can see from the response i need access to the Guid tag in the ticket header. How do I access this?

 

To sum it up i can access the body of the response but not the header.

 

Any help really appreciated!

 

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/263128-soap-headers/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.