1

I'm new to SOAP and I can't figure how to create a SOAP header using the following template:

I am programming in PHP using SoapClient.

 <SOAP-ENV:Header>
    <Username xmlns="http://something.com/WebServices/SMSPush">User</Username>
    <Password xmlns="http://something.com/WebServices/SMSPush">Pass</Password>
    <To SOAP-ENV:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://wsmcg002.something.sys:8004/SmsPushService.svc</To>
    <Action SOAP-ENV:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">SendMultipleTextMessage</Action>
</SOAP-ENV:Header>

1 Answer 1

2

You set the SOAP header using SoapHeader class

<?php
$client = new SoapClient(...);

$headers = array();
$headers[] = new SoapHeader('http://something.com/WebServices/SMSPush', 'Username', 'Usser');
$headers[] = new SoapHeader('http://something.com/WebServices/SMSPush', 'Password', 'Pass');
$headers[] = new SoapHeader('http://schemas.microsoft.com/ws/2005/05/addressing/none', 'To', 'http://wsmcg002.something.sys:8004/SmsPushService.svc', true);
$headers[] = new SoapHeader('http://schemas.microsoft.com/ws/2005/05/addressing/none', 'Action', 'SendMultipleTextMessage', true);
$client->__setSoapHeaders($headers);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.