I need to send a soap request with soap header and body.
I have the request soap xml.
I had use different curl and soap client but nothing is working.
Some one please help.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v2="http://www.v.com/schema/" xmlns:loc="http://www.c.org/local">
<soapenv:Header>
<RequestSOAPHeader xmlns="http://www.h.com/schema/1">
<s1>000201</s1>
<s2>e6434ef249df55c7a21a0b45758a39bb</s2>
<s3>35000001000001</s3>
<s4>20100731064245</s4>
</RequestSOAPHeader>
</soapenv:Header>
<soapenv:Body>
<loc:start>
<loc:reference>
<c1>http://desertcreator.com/nct</c1>
<c2>notify</c2>
<c3>1</c3>
</loc:reference>
<loc:w1>1234</loc:w1>
<loc:w2>demand</loc:w2>
</loc:start>
</soapenv:Body>
</soapenv:Envelope>
Thanks
Related
I am trying to call a soap api
I have the following request xml and wsdl addresses.
test WSDL URL
http://demo-activityws.touricoholidays.com/ActivityBookFlow.svc?wsdl
sample request xml
how can i get response from API ???
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:aut="http://schemas.tourico.com/webservices/authentication" xmlns:act="http://tourico.com/webservices/activity" xmlns:act1="http://schemas.tourico.com/webservices/activity">
<soapenv:Header>
<aut:AuthenticationHeader>
<aut:LoginName>John</aut:LoginName>
<aut:Password>Johnpass</aut:Password>
<aut:Culture>en_US</aut:Culture>
<aut:Version>8</aut:Version>
</aut:AuthenticationHeader>
</soapenv:Header>
<soapenv:Body>
<act:SearchActivityByAirPortCode>
<act:SearchRequest destination="MCO" cityName="Orlando">
<act1:FromDate>2017-03-23</act1:FromDate>
<act1:ToDate>2017-03-25</act1:ToDate>
<act1:Filters>
<act1:MinAdults>
<act1:Value>0</act1:Value>
</act1:MinAdults>
<act1:MinChildren>
<act1:Value>0</act1:Value>
</act1:MinChildren>
<act1:MinUnits>
<act1:Value>0</act1:Value>
</act1:MinUnits>
<act1:CategoryName>
<act1:Value>Theme Parks</act1:Value>
</act1:CategoryName>
<act1:CategoryId>
<act1:Value>592</act1:Value>
</act1:CategoryId>
<act1:ActivityName>
<act1:Value>SeaWorld Orlando</act1:Value>
</act1:ActivityName>
</act1:Filters>
</act:SearchRequest>
</act:SearchActivityByAirPortCode>
</soapenv:Body>
</soapenv:Envelope>
How I can receive a soap request in my controller? For your convenient I am sharing the sample soap format. From this I need to get "message" field. Can you please suggest me any solution.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<ns1:NotifySOAPHeader xmlns:ns1="http://www.huawei.com.cn/schema/common/v2_1">
<ns1:timeStamp>111029084631570</ns1:timeStamp> <ns1:traceUniqueID>100001200101110623021721000011</ns1:traceUniqueID>
</ns1:NotifySOAPHeader>
</soapenv:Header>
<soapenv:Body>
<ns2:notifySmsReception xmlns:ns2="http://www.csapi.org/schema/parlayx/sms/notification/v2_2/local">
<ns2:correlator>00001</ns2:correlator>
<ns2:message>
<message>Hello world</message>
<dateTime>2010-08-09T00:00:00.000+08:00</dateTime>
</ns2:message>
</ns2:notifySmsReception>
</soapenv:Body>
</soapenv:Envelope>
Hi i have this WSDL that, when i test in soapUI, it works well.
but i am having problems to call it from php soap client.
<soapenv:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:uXXX">
<soapenv:Header/>
<soapenv:Body>
<urn:Pesquisar soapenv:encodingStyle=
"http://schemas.xmlsoap.org/soap/encoding/">
<active xsi:type="xsd:boolean">true</active>
</urn:Pesquisar>
</soapenv:Body>
</soapenv:Envelope>
i am trying in PHP something like this:
$client = new \SoapClient($mywsdl);
$headers[] = new \SoapHeader('urn:uXXX', 'urn');
$client->__setSoapHeaders($headers);
var_dump($client->Pesquisar(['parameters'=>['active' => true]]));
PS: This soap, doens have authentication, because i am inside a server that have access to the soap server.
I need to access user name and password from the soap header inside php script. I can access the body information but could not access the header information.
Here is the SOAp...
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sec="http://schemas.xmlsoap.org/ws/2002/04/secext"
xmlns:met="http://www.example.com/data">
<soapenv:Header>
<sec:Security>
<UsernameToken>
<Username>ron</Username>
<Password>pass</Password>
</UsernameToken>
</sec:Security>
</soapenv:Header>
<soapenv:Body>
<met:columnInfo>
<databaseName>MySQL</adaptorName>
<tableName>product</tableName>
</met:columnInfo>
</soapenv:Body>
</soapenv:Envelope>
Any help will be really appreciated.
Ok found the solution for that.
$server = new SoapServer($anywsdl);
$server->addFunction(addAllFuntions);
$server->handle();
Then in the same php script,
function Security($data){
$UserToken=get_object_vars($data);
foreach($UserToken as $uToken){
$credentialArray=get_object_vars($uToken);
echo $credentialArray['Username'];
echo $credentialArray['Password'];
}
}
You would need $server->setClass($yourClass), if the Security() function was in different class.
I'm having a problem in order to create a soap call. As one can see the header that is being supplied from a 3rd party client doesn't have a header name. I need to create a soap call by passing the username and password to the soap request which doesn't have a name in the header. I have tried several examples but no success. The call below works in soap UI but I'm having serious problems when it comes to php. Any help would be much appreciated
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:int="http://namespace.example.com/">
<soapenv:Header>
<int:password>123</int:password>
<int:login>abc</int:login>
</soapenv:Header>
<soapenv:Body>
<int:getEventTree>
<!--Optional:-->
<lang>en</lang>
</int:getEventTree>
</soapenv:Body>
</soapenv:Envelope>
Please take a look at http://php.net/manual/en/soapclient.dorequest.php
You can use code like:
$response = $soapClient->__doRequest(
$request,
$endpoint,
$soapAction,
$soapVersion,
$one_way
);
$request could be defined as a string containing xml, such as:
$request =
'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/""xmlns:int="http://namespace.example.com/">
<soapenv:Header>
<int:password>123</int:password>
<int:login>abc</int:login>
</soapenv:Header>
<soapenv:Body>
<int:getEventTree>
<!--Optional:-->
<lang>en</lang>
</int:getEventTree>
</soapenv:Body>
</soapenv:Envelope>';
You can define the rest of the arguments in the __doRequest() call depending on your configuration.