Jump to content

Recommended Posts

WSDL

 

<wsdl:definitions targetNamespace="BLANKED"><wsdl:types><s:schema elementFormDefault="qualified" targetNamespace="BLANKED"><s:element name="GetPlatformByUserAgent"><s:complexType><s:sequence><s:element minOccurs="0" maxOccurs="1" name="pUserAgent" type="s:string"/></s:sequence></s:complexType></s:element><s:element name="GetPlatformByUserAgentResponse"><s:complexType><s:sequence><s:element minOccurs="0" maxOccurs="1" name="GetPlatformByUserAgentResult" type="s:string"/></s:sequence></s:complexType></s:element></s:schema></wsdl:types><wsdl:message name="GetPlatformByUserAgentSoapIn"><wsdl:part name="parameters" element="tns:GetPlatformByUserAgent"/></wsdl:message><wsdl:message name="GetPlatformByUserAgentSoapOut"><wsdl:part name="parameters" element="tns:GetPlatformByUserAgentResponse"/></wsdl:message><wsdl:portType name="WebSiteServicesSoap"><wsdl:operation name="GetPlatformByUserAgent"><wsdl:input message="tns:GetPlatformByUserAgentSoapIn"/><wsdl:output message="tns:GetPlatformByUserAgentSoapOut"/></wsdl:operation></wsdl:portType><wsdl:binding name="WebSiteServicesSoap" type="tns:WebSiteServicesSoap"><soap:binding transport="http://schemas.xmlsoap.org/soap/http"/><wsdl:operation name="GetPlatformByUserAgent"><soap:operation soapAction="http://BLANK/GetPlatformByUserAgent" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation></wsdl:binding><wsdl:binding name="WebSiteServicesSoap12" type="tns:WebSiteServicesSoap"><soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/><wsdl:operation name="GetPlatformByUserAgent"><soap12:operation soapAction="http://BLANK/GetPlatformByUserAgent" style="document"/><wsdl:input><soap12:body use="literal"/></wsdl:input><wsdl:output><soap12:body use="literal"/></wsdl:output></wsdl:operation></wsdl:binding><wsdl:service name="WebSiteServices"><wsdl:port name="WebSiteServicesSoap" binding="tns:WebSiteServicesSoap"><soap:address location="http://BLANK/WebSiteServices.asmx"/></wsdl:port><wsdl:port name="WebSiteServicesSoap12" binding="tns:WebSiteServicesSoap12"><soap12:address location="http://BLANK/WebSiteServices.asmx"/></wsdl:port></wsdl:service></wsdl:definitions>

 

Code I am using

    <?php
class GetPlatformByUserAgent{
public $useragent = 1234 ;
//$a = $_SERVER['HTTP_USER_AGENT'];
};
$client = new SoapClient("http://BLANK.asmx?wsdl");
$response = $client->GetPlatformByUserAgent("Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)");
echo $response

?>

Error I get

 

( ! ) Fatal error: Uncaught SoapFault exception: [soap:Server] Server was unable to process request. ---> Object reference not set to an instance of an object. in C:\wamp\websites\projects\soap\test.php:7 Stack trace: #0 C:\wamp\websites\projects\soap\test.php(7): SoapClient->__call('GetPlatformByUs...', Array) #1 C:\wamp\websites\projects\soap\test.php(7): SoapClient->GetPlatformByUserAgent('Mozilla/4.0 (co...') #2 {main} thrown in C:\wamp\websites\projects\soap\test.php on line 7

 

 

Any ideas where I am going wrong as I'm new to SOAP calls?

Link to comment
https://forums.phpfreaks.com/topic/274768-php-soap-call/
Share on other sites

Hi there,

 

You need to pass in the name of the parameter (as an array) as well:

 

 

<?php
class GetPlatformByUserAgent{
public $useragent = 1234 ;
//$a = $_SERVER['HTTP_USER_AGENT'];
};
$client = new SoapClient("[url="http://BLANK.asmx?wsdl"]http://BLANK.asmx?wsdl"[/url]);
$response = $client->GetPlatformByUserAgent(array("pUserAgent" => "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)"));
echo $response

?>

 

Cheers,

Steve

Edited by StevenFullman
Link to comment
https://forums.phpfreaks.com/topic/274768-php-soap-call/#findComment-1413900
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.