Re: how to send the request through XML using command prompt.

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

 



On 17 February 2011 06:33, valluriravi <valluriravi9@gmail.com> wrote:
>
> Hi All,
>
> Â Â Â We are new to soap with PHP. As per our reqirment we need how to send
> the request through XML
> with soap and how to get the response as XML through soap using command
> prompt.
>
> We are having WSDL link with us.
>
> http://www.timevalue.com/webservices/tve.asmx?WSDL
>
> Please send any reference Links for this requirment.
>
> Regards
> Ravi.

First of all, make sure you can run PHP from the command line. I use
Windows and the documentation on pages [1] and [2] cover the necessary
elements/setup to make effective use of PHP at the command line. If
you are not on Windows, then you need to read [3].

In terms of creating something that can use the wsdl file you
provided, I'd recommend using the wsdl2php from sourceforge ([4] and
[5]). I've attached my copy of wsdl2php to this email (if it doesn't
get through to you directly let me know).

Having got wsdl2php installed and have PHP configured along the lines
I've suggested in the documentation, then you need to build your local
classes for the service.

You do this by ...

MD C:\wsdl\timevalue
CD C:\wsdl\timevalue
C:\PHP5\php.exe -f C:\PHP5\PEAR\wsdl2php --
http://www.timevalue.com/webservices/tve.asmx?WSDL

You'll now have a file called C:\wsdl\timevalue\tve.php [6]

This contains all the classes you need. Take a look through it. You
can see how it has created a SoapClient subclass and a class for each
complex type used by the service as well as the response types for
each service method.

The service class is called tve and it has 4 methods.

I use a simple script [7] to prove the service by calling the Hello
World method.

I call the script C:\wsdl\timevalue\consume.php

Running consume (or C:\PHP5\php.exe -f C:\wsdl\timevalue\consume.php
if you haven't done all the things needed for full CLI integration),
will produce an output of [8].

>From here on, it is just a case of working out which methods you want
to use, creating the appropriate parameter objects and populating them
just like you would for any other PHP class.


As the service returns a cookie, you may need to extract this and
supply it with your subsequent calls.

	// A session cookie is supplied in the response header, extract this
and add it to the service via __setCookie() on subsequent requests.
	preg_match('`Set-Cookie:
(?P<Cookie>(?P<CookieName>[^=]*)=(?P<CookieValue>[^;]*);)`',
$o_Service->__getLastResponseHeaders(), $a_CookieMatch);
	$o_Service->__setCookie($a_CookieMatch['CookieName'],
$a_CookieMatch['CookieValue']);

You may have to extend this if more than 1 cookie is supplied.


I hope this helps you somewhat. If you get stuck, please come back.

Try the code I've supplied before attempting to integrate it into any
of your code. If you can't get this working, then integrating non
working code will only confuse things more.

Regards,

Richard.


[1] http://docs.php.net/manual/en/install.windows.manual.php
[2] http://docs.php.net/manual/en/install.windows.commandline.php
[3] http://docs.php.net/manual/en/install.unix.commandline.php
[4] http://www.urdalen.no/wsdl2php/
[5] http://sourceforge.net/projects/wsdl2php/
[6] http://pastebin.com/WiYgK34g
[7] http://pastebin.com/Ane2JUeR
[8] http://pastebin.com/MfwrJimM
-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

Attachment: wsdl2php.php
Description: application/httpd-php

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

[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux