views:

741

answers:

5

My customer has a PHP web service, that they want me to use. It's PHP-based, while my web is ASP-based.

The ASP code looks like this:

Dim soapclient

WSDL_URL = "http://xxx.xxxx.xx/index.php?Action=service"

set soapclient = Server.CreateObject("MSSOAP.SoapClient30")

soapclient.ClientProperty("ServerHTTPRequest") = True

on error resume next

soapclient.mssoapinit WSDL_URL ' error here

Is ASP able to call a PHP-based soap service?

or

What should I adjust?

Thanks a lot!

+1  A: 

I don't know ASP, I know PHP but you should have no problem accessing PHP web services from any other language, simply because the communication format is XML. Both applications would communicate using a third, intermediary language: XML. All should be fine.

Ionuț G. Stan
XML is ok. But call is like$ret = $client->__soapCall("getList",array());ASP soapclient.mssoapinit WSDL_URL, "getList"will error
March
I don't understand. Which language provides the web-service server and which the web-service client?
Ionuț G. Stan
ASP client, PHP provider
March
@March, if PHP is the provider, then you must use its SoapServer class, not SoapClient class. http://www.php.net/manual/en/class.soapserver.php
Ionuț G. Stan
He's writing the client, not the server.
Michael Borgwardt
@Michael, but just above he pasted some PHP code which involves a SoapClient. I assume he's doing some tests and doesn't have the knowledge about the PHP API.
Ionuț G. Stan
That's not PHP code.
Michael Borgwardt
@Michael, $ret = $client->__soapCall("getList",array()); is PHP code.
Ionuț G. Stan
+6  A: 

The whole point of web services and SOAP is that it does not matter what language the service is implemented in and on what hardware and OS it runs.

Either there is a bug in the web service or (more likely) you're calling it in a wrong way.

Michael Borgwardt
+1  A: 

We find a way to solve this question is not use "MSSOAP.SoapClient30" to ask web service, but "Msxml2.ServerXMLHTTP.4.0".

Sample code like this:

url = "http://xxx.xxx.xx/xxx.php"

SoapRequest="<?xml version="&CHR(34)&"1.0"&CHR(34)&" encoding="&CHR(34)&"utf-8"&CHR(34)&"?>" "<soap:Envelope xmlns:xsi="&CHR(34)&"http://www.w3.org/2001/XMLSchema-instance"&amp;CHR(34)&amp;" xmlns:xsd="&CHR(34)&"http://www.w3.org/2001/XMLSchema"&amp;CHR(34)&amp;" xmlns:soap="&CHR(34)&"http://schemas.xmlsoap.org/soap/envelope/"&amp;CHR(34)&amp;"&gt;&lt;soap:Body&gt;&lt;getList&gt;&lt;/getList&gt;&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;"

Set xmlhttp = server.CreateObject("Msxml2.ServerXMLHTTP.4.0")

xmlhttp.Open "POST",url,false

xmlhttp.setRequestHeader "Content-Type", "text/xml;charset=utf-8"

xmlhttp.setRequestHeader "Content-Length",LEN(SoapRequest)

xmlhttp.Send(SoapRequest)

Response.Write xmlhttp.responseText

Set xmlhttp = Nothing

March
A: 

In Asp.net this isn't a problem, you can reference any WSDL. That's the cool thing about webservices. they are completely transperant to the other development environment. We actually use a php webservice from one of our clients in our .net environment. so I'm pretty sure it must be possible for ASP to. maybe this link can help out:

http://forums.digitalpoint.com/showthread.php?t=36833

Sem Dendoncker
A: 

For starters you should remove the 'on error resume next' so you can see (and post) the error you're getting.

SkippyFlipjack