Colin G - 2005-01-18

Hi All,

With my limited understanding of namespaces and how to set call parameters, I need help to be able to send an 'RPC literal' request that uses WSDL. The service, MyHelloWorld, was set up with Grand Central's Process Designer and works when called within their environment. The SOAP request that works and which I am trying to emulate looks like the XML below. The following point was made to me:

Notice that whilst <MyHelloWorld> is namespace-qualified, the part
element <helloRequest> is not. However, the children of <helloRequest>
are namespace-qualified.

This is apparently an RPC-literal convention that should be honored by
code generators working from the process WSDL.

<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:si="http://soapinterop.org/xsd"
xmlns:targetNS="bizconnector.grandcentral.com/MyHelloWorld">
<SOAP-ENV:Body>
<m:MyHelloWorld xmlns:m="bizconnector.grandcentral.com/MyHelloWorld">
    <helloRequest>
        <m:firstName>YourFirstName</m:firstName>
            <m:lastName>YourLastName</m:lastName>
    </helloRequest>
</m:MyHelloWorld>
</SOAP-ENV:Body></SOAP-ENV:Envelope>

The request that I am generating is:

<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:si="http://soapinterop.org/xsd" xmlns:targetNS="bizconnector.grandcentral.com/MyHelloWorld">
<SOAP-ENV:Body>
<MyHelloWorld xmlns="bizconnector.grandcentral.com/MyHelloWorld">
  <helloRequest>
     <firstName>Colin</firstName>
     <lastName>Goldberg</lastName>
  </helloRequest>
</MyHelloWorld>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Here's my client:

<?php

$this_dir = dirname(__FILE__);
require_once($this_dir . '/../../libs/web_services/nusoap/nusoap.php');

$wsdl_url1 = "http://www.thebizconnector.com/web_services/wsdl/MyHelloWorld.wsdl";
$helloReqArray = array('firstName'=>'Colin', 'lastName' => 'Goldberg');
$params = array('helloRequest' => $helloReqArray);

$soapclient = new soapclient($wsdl_url1, true);
if($err = $soapclient->getError()){
    echo "new soapclient error $err\n";
} else {
    $soapclient->setCredentials('<userid supplied>', '<password supplied>');
    $ret_val = $soapclient->call('MyHelloWorld',$params, 'm');
  
    echo $soapclient->request, ENT_QUOTES;
    echo $soapclient->response, ENT_QUOTES;
    if($err = $soapclient->getError()){
        echo "soapclient call error $err\n\n";
        echo htmlspecialchars($soapclient->debug_str, ENT_QUOTES);
    } else {
        echo "returned $ret_val\n";
    }
}

?>

WSDL contents:
<definitions targetNamespace="bizconnector.grandcentral.com/MyHelloWorld" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:targetNS="bizconnector.grandcentral.com/MyHelloWorld" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns8="http://schemas.xmlsoap.org/wsdl/">
                        <types xmlns="http://schemas.xmlsoap.org/wsdl/">
                            <schema elementFormDefault="qualified" targetNamespace="bizconnector.grandcentral.com/MyHelloWorld" xmlns="http://www.w3.org/2001/XMLSchema">
                                <complexType name="Request" xmlns="http://www.w3.org/2001/XMLSchema">
                                    <sequence xmlns="http://www.w3.org/2001/XMLSchema">
                                        <element name="firstName" type="xsd:string" xmlns="http://www.w3.org/2001/XMLSchema"/>
                                        <element name="lastName" type="xsd:string" xmlns="http://www.w3.org/2001/XMLSchema"/>
                                    </sequence>
                                </complexType>
                                <complexType name="Response" xmlns="http://www.w3.org/2001/XMLSchema">
                                    <sequence xmlns="http://www.w3.org/2001/XMLSchema">
                                        <element name="greeting" type="xsd:string" xmlns="http://www.w3.org/2001/XMLSchema"/>
                                    </sequence>
                                </complexType>
                            </schema>
                        </types>
                        <message name="MyHelloWorldRequest" xmlns="http://schemas.xmlsoap.org/wsdl/">
                            <part name="helloRequest" type="targetNS:Request" xmlns="http://schemas.xmlsoap.org/wsdl/"/>
                        </message>
                        <message name="MyHelloWorldResponse" xmlns="http://schemas.xmlsoap.org/wsdl/">
                            <part name="helloResponse" type="targetNS:Response" xmlns="http://schemas.xmlsoap.org/wsdl/"/>
                        </message>
                        <portType name="MyHelloWorldPort" xmlns="http://schemas.xmlsoap.org/wsdl/">
                            <operation name="MyHelloWorld" xmlns="http://schemas.xmlsoap.org/wsdl/">
                                <input message="targetNS:MyHelloWorldRequest" xmlns="http://schemas.xmlsoap.org/wsdl/"/>
                                <output message="targetNS:MyHelloWorldResponse" xmlns="http://schemas.xmlsoap.org/wsdl/"/>
                            </operation>
                        </portType>
                        <binding name="MyHelloWorldBinding" type="targetNS:MyHelloWorldPort" xmlns="http://schemas.xmlsoap.org/wsdl/">
                            <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
                            <operation name="MyHelloWorld" xmlns="http://schemas.xmlsoap.org/wsdl/">
                                <soap:operation soapAction="mysoapaction"/>
                                <input xmlns="http://schemas.xmlsoap.org/wsdl/">
                                    <soap:body namespace="bizconnector.grandcentral.com/MyHelloWorld" use="literal"/>
                                </input>
                                <output xmlns="http://schemas.xmlsoap.org/wsdl/">
                                    <soap:body namespace="bizconnector.grandcentral.com/MyHelloWorld" use="literal"/>
                                </output>
                            </operation>
                        </binding>
                        <service name="MyHelloWorld" xmlns="http://schemas.xmlsoap.org/wsdl/">
                            <port binding="targetNS:MyHelloWorldBinding" name="MyHelloWorldPort" xmlns="http://schemas.xmlsoap.org/wsdl/">
                                <soap:address location="http://pop.grandcentral.com/sync/soap/bizconnector.grandcentral.com/MyHelloWorld"/>
                            </port>
                        </service>
                    </definitions>

Can you help me generate the correct request as suggested above?

Colin Goldberg