Jump to content

Recommended Posts

Hi there

I'm trying to get an answer for a soap request

This is the info provided by the software house about the request:

POST /myTest/Services.asmx HTTP/1.1
Host: 127.0.0.1
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://------.--/myTest/Addons"

<?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:Body>
    <Addons xmlns="http://------.--/myTest/">
      <hotelUnit>string</hotelUnit>
      <initialDate>dateTime</initialDate>
      <finalDate>dateTime</finalDate>
      <roomStays>
        <RoomStayOfPAX>
          <PaxPerRoom>
            <PAX xsi:nil="true" />
            <PAX xsi:nil="true" />
          </PaxPerRoom>
          <RoomType>string</RoomType>
          <Allotment>
            <Allotment>string</Allotment>
          </Allotment>
        </RoomStayOfPAX>
        <RoomStayOfPAX>
          <PaxPerRoom>
            <PAX xsi:nil="true" />
            <PAX xsi:nil="true" />
          </PaxPerRoom>
          <RoomType>string</RoomType>
          <Allotment>
            <Allotment>string</Allotment>
          </Allotment>
        </RoomStayOfPAX>
      </roomStays>
      <onlyFixedValue>boolean</onlyFixedValue>
    </Addons>
  </soap:Body>
</soap:Envelope>

I'm trying to use this code for the request passing the xml on $parameters

			$ch = curl_init();		
			curl_setopt($ch, CURLOPT_URL,$baseurl.$command);		
			curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);		
			curl_setopt($ch, CURLOPT_TIMEOUT,180);		
			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");  		
			curl_setopt($ch, CURLOPT_POST, true);		
			curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters);   		
			curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);		
			curl_setopt($ch, CURLOPT_USERPWD, "$login:$password");		
			curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);		
			curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);		
			$result = curl_exec($ch);
			if($result === false){			
				echo 'Curl error: ' . curl_error($ch);		
			}  else {			
				//$result = simplexml_load_string($result);		
			}		
			curl_close($ch);  		
			return($result);

But I get an invalid request.

myTest is over a self signed ssl certificate and with basic authentication. Maybe the problem resides there or in the request itself.

Anyone can help me with this ? Best regards.

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.