Re: How to work with Webservices (.asmx) server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hoi Anton,

Great job on the Dutch part :) But please keep the thread on list.

You have set the server location when you create a SOAP client instance.
Take a look at : http://php.net/manual/en/soapclient.soapclient.php

So when instantiating the SOAP client object you pass as a second
parameter. An array with as minimal settings the location and uri.

I guess in your case it would be something like this:

$client = new SoapClient(null, array(
	'location' =>  "http://localhost/WebService/GetData.asmx";,
        'uri'      => "http://localhost/WebService/";)
);

And if your webservice provides a WSDL file you can replace the null
parameter for that one.

Anton Heuschen wrote:
> Dag.
> 
> Dank U well.
> 
> Lol and thats where my Dutch is going to end...
> 
> 
> Thank you for the info, just one question that had me confused also and
> that is to do with this
> 
> the URL you actually are talking to with your SOAP client is
> http://localhost/WebService/
> 
> 
> 
> Ive seen that in material on the net too ... but I wondered so how does
> your SOAP request know where to connect to ? should I not have the
> target server URL (or is this also pointing to the Web Services Servers
> WSDL not setup correctly and will my client only work if I run it from
> the same PC? ) This is what confuses me so .
> 
> 
> Regards
> 
> 2009/3/10 Thijs Lensselink <php@xxxxxxxxxxxxxx <mailto:php@xxxxxxxxxxxxxx>>
> 
>     Anton Heuschen wrote:
>     > I am confused with XML-RPC / SOAP and WSDL ...
>     >
>     > If you have a server with a script/file like test.asmx and some web
>     > services ...below example of service format :
>     >
>     > SOAP 1.2
>     >
>     > The following is a sample SOAP 1.2 request and response. The
>     > placeholders shown need to be replaced with actual values.
>     >
>     > -------------------------------------  SAMPLE OF Web Service from the
>     > server below :
>     >
>     > SOAP 1.2
>     >
>     > The following is a sample SOAP 1.2 request and response.  The
>     > placeholders shown need to be replaced with actual values.
>     >
>     >
>     >
>     >
>     > POST /webservice/GetData.asmx HTTP/1.1
>     > Host: www.theserver.com <http://www.theserver.com>
>     > Content-Type: application/soap+xml; charset=utf-8
>     > Content-Length: length
>     >
>     > <?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>
>     >     <GetData xmlns="http://localhost/WebService/";>
>     >       <Input>string</Input>
>     >     </GetData>
>     >   </soap12:Body>
>     > </soap12:Envelope>
>     >
>     >
>     >
>     > HTTP/1.1 200 OK
>     > Content-Type: application/soap+xml; charset=utf-8
>     > Content-Length: length
>     >
>     > <?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>
>     >     <GetDataResponse xmlns="http://localhost/WebService/";>
>     >       <Output>string</Output>
>     >     </GetDataResponse>
>     >   </soap12:Body>
>     > </soap12:Envelope>
>     >
>     >
>     >
>     > ------------------------------------ END OF SAMPLE
>     >
>     >
>     >
>     >
>     > I spend about most of my time looking at SOAP, XML-RPC and the PHP
>     > SOAP extension, like from here:
>     >
>     >
>     http://tutorial.jcwcn.com/Web-Design/PHP/XML-and-PHP/2008-08-15/10160.html
>     >
>     >
>     > Most of these talk about request to the server and a script with .wsdl
>     > extension ... but from the example SOAP 1.2 "framework" above
>     > and the fact that the url to the web service is not a .wsdl file but
>     > in fact a .asmx file, how on earth to you
> 
>     It doesn't have to be a .wsdl extension to offer that functionality. The
>     WSDL output is nothing more then what the webservice has to offer.
>     Requests are not send to the .wsdl but to the webservice endpoint.
> 
>     >
>     > 1) post a request to the example above.
>     > 2) What do you use here now actually ? SOAP/XML-RPC/WSDL ? or is this
>     > something else ? Its extremely confusing since this does
>     > not seem to fit in with any of the examples, material on the net.
>     >
> 
>     The examples above show requests en responses in the SOAP format. You
>     could target this webservice in multiple ways. But building a SOAP
>     client would probably be the best option.
> 
>     > I basically need to call the service and pass "string" to the Input
>     > parameter and get the response field.
>     >
>     >
>     > Some examples using the PHP Soap class talk about setting the URI, the
>     > host and the NS and I don't know from the example SOAP 1.2 fields
>     > provided where this should be taken from.
>     >
> 
>     the URL you actually are talking to with your SOAP client is
>     http://localhost/WebService/
> 
>     >
>     > Some guidelines to good documentation/howto or tutorials and/or some
>     > examples and functions/class would be
>     > appreciated immensely
> 
>     http://wso2.org/library/1060
> 
>     >
>     > Regards
>     >
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux