开发者

Calling Classic ASP Web Service from PHP

开发者 https://www.devze.com 2023-02-10 22:12 出处:网络
I am wanting to call a Classic ASP web service from PHP. Here is the service: <% Response.Buffer = True

I am wanting to call a Classic ASP web service from PHP.

Here is the service:

<%
    Response.Buffer = True
    Response.ContentType = "text/xml"

    Set xmldom = Server.CreateObject("Microsoft.XMLDOM")
    Set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP")

Sub Test()
    returnXML = ""
    returnXML = returnXML & "<SOAP:Envelope xmlns:SOAP=""urn:schemas-xmlsoap-org:soap.v1"">"
    returnXML = returnXML & "<SOAP:Body>"
    returnXML = returnXML & "<message>"
    returnXML = returnXML & "<theword>Hello</theword>"
    returnXML = returnXML & "</message>"
    returnXML = returnXML & "</SOAP:Body>"
    returnXML = returnXML & "</SOAP:Envelope>"

    Response.Write(returnXML)       
End Sub

    Set xmldom = 开发者_如何学JAVANothing
    Set xmlhttp = Nothing
%>

I want to call this service from PHP in non-WSDL mode. How can I do this? How do I call a specific function within the service?

Here is how I am trying to call the service from PHP:

<?php
    $client = new SoapClient(
                null, array(
                        'location' => "http://server/folder/server.asp",
                        'uri'      => "http://test-uri/",
                        'style'    => SOAP_DOCUMENT,
                        'use'      => SOAP_LITERAL,
                        'trace'=>1
                      )
        );

        $result = $client->Test();
        $client->__getLastResponse();
?> 

Thanks...


Try using $client->__soapCall(): http://us3.php.net/manual/en/soapclient.soapcall.php.

I don't believe you can use direct method calls in non-WSDL mode.

Edit:

Also, your web service in .asp is not returning any content. A webservice doesn't actually call a method like Test() on the server. SOAP is merely a protocol for language-agnostic communication of calls and parameters. The server needs to actually take the call and apply it to the proper intended method.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号