Calling a web service from php? -


All,

The Atlest installed our peer SOAP module on our Apache server. Now when I try the following code - it is giving me "HTTP Bad Request" Can anyone help?

  & lt; Html & gt; & Lt; Body & gt; & Lt ;? Include SOAP_Client class of Php / * PEAR :: SOAP: * / require_once ('SOAP / Client.php'); $ Zip = $ _REQUEST ['zip']; ? & Gt; & Lt; Form action = "wszip.php" method = "post" & gt; & Lt; Table cells = "10" bg color = "cadetle" & gt; & Lt; TR & gt; & Lt; Td> & Lt; B & gt; Enter zip code: & lt; / B & gt; & Lt; Input type = "article" name = "zip" /> & lt; / Td> & Lt; TD & gt; & Lt; / TD & gt; & Lt; Td> & Lt; Input type = "submit" value = "find it!" /> Gt; & Lt; / Td> & Lt; / TR & gt; & Lt; / Table & gt; & Lt; BR & gt; & Lt; BR & gt; & Lt; BR & gt; & Lt; BR & gt; & Lt; / Form & gt; & Lt ;? Php if ($ zip! = "") {$ Wsdl_url = "http://www.webservicex.net/uszip.asmx?WSDL"; $ Wsdl = new SOAP_WSDL ($ wsdl_url); $ Client = $ wsdl- & gt; GetProxy (); $ Params = array ('USZip' = & gt; $ zip); $ Response = $ client- & gt; GetInfoByZIP ($ params); Echo $ reaction; }? & Gt; & Lt; / Body & gt; & Lt; / Html & gt;  

Thanks.

this

  $ client = $ wsdl-> getProxy (); // Do not wrap it in another array. // $ params = array ('USZip' = & gt; $ zip); $ Response = $ client- & gt; GetInfoByZIP ($ zip); Var_dump ($ response);  
But before seeing any results, my screen flooded with the "PHP excluded:" and "PHP strict standards: non-static method ..." messages. I instead of
  & lt ;? Php echo PHP_VERSION, '', PHP_OS, "\ n"; $ Client = new sop client (''); $ Response = $ client- & gt; GetInfoByZIP (Arrays ('USZip' = & gt; '10006')); Var_dump ($ response);  
Unfortunately the response
 & lt; S is defined as: element minOccurs = "0" maxOccurs = "1" name = "GetInfoByZIPResult" & gt; & Lt; S: complex type blended = "true" & gt; & Lt; S: Sequence & gt; & Lt; S: any / & gt; & Lt; / S: Sequence & gt; & Lt; / S: complexType & gt; & Lt; / S: element & gt; 
which means almost "translated ... something ...", that means you have to parse "manual" XML.
  & lt ;? Php echo PHP_VERSION, '', PHP_OS, "\ n"; $ Client = new sop client (''); $ Response = $ client- & gt; GetInfoByZIP (Arrays ('USZip' = & gt; '10006'));  

$ doc = New SimpleXMlelement ($ response-> any of the GetInfoByZIPResult->); Echo 'city:', $ doc- & gt; Table- & gt; CITY [0];

print
 5.3.0 RC4 win city: New York 


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -