Dani Ac2 - 2011-04-28

Hi,

I am getting some issues when I try to invoke a method of WS. The request Object is always null.

This is the wsdl:

<definitions targetNamespace="http://appcodigos.yum.com/" name="AppCodigosWSService">
    <types>
        <xsd:schema>
            <xsd:import namespace="http://appcodigos.yum.com/" schemaLocation="http://localhost:8888/appCodigosWS/appcodigos?xsd=1"/>
        </xsd:schema>
    </types>
    <message name="procesarPeticion">
        <part name="parameters" element="tns:procesarPeticion"/>
    </message>
    <message name="procesarPeticionResponse">
        <part name="parameters" element="tns:procesarPeticionResponse"/>
    </message>
    <portType name="IAppCodigosWS">
        <operation name="procesarPeticion">
            <input message="tns:procesarPeticion"/>
            <output message="tns:procesarPeticionResponse"/>
        </operation>
    </portType>
    <binding name="AppCodigosWSPortBinding" type="tns:IAppCodigosWS">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
        <operation name="procesarPeticion">
            <soap:operation soapAction=""/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
        </operation>
    </binding>
    <service name="AppCodigosWSService">
        <port name="AppCodigosWSPort" binding="tns:AppCodigosWSPortBinding">
            <soap:address location="http://localhost:8888/appCodigosWS/appcodigos"/>
        </port>
    </service>
</definitions>

and this is the xsd

<xs:schema version="1.0" targetNamespace="http://appcodigos.yum.com/">
    <xs:element name="procesarPeticion" type="tns:procesarPeticion"/>
    <xs:element name="procesarPeticionResponse" type="tns:procesarPeticionResponse"/>
    <xs:complexType name="procesarPeticion">
        <xs:sequence>
            <xs:element name="arg0" type="tns:request" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="request">
        <xs:sequence>
            <xs:element name="param1" type="xs:string" minOccurs="0"/>
            <xs:element name="param2" type="xs:string" minOccurs="0"/>
            <xs:element name="param3" type="xs:string" minOccurs="0"/>
            <xs:element name="param4" type="xs:string" minOccurs="0"/>
            <xs:element name="tipoOperacion" type="xs:int"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="procesarPeticionResponse">
        <xs:sequence>
            <xs:element name="return" type="tns:response" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="response">
        <xs:sequence>
            <xs:element name="cod_Respuesta" type="xs:string" minOccurs="0"/>
            <xs:element name="des_Respuesta" type="xs:string" minOccurs="0"/>
            <xs:element name="param1" type="xs:string" minOccurs="0"/>
            <xs:element name="param10" type="xs:string" minOccurs="0"/>
            <xs:element name="param2" type="xs:string" minOccurs="0"/>
            <xs:element name="param3" type="xs:string" minOccurs="0"/>
            <xs:element name="param4" type="xs:string" minOccurs="0"/>
            <xs:element name="param5" type="xs:string" minOccurs="0"/>
            <xs:element name="param6" type="xs:string" minOccurs="0"/>
            <xs:element name="param7" type="xs:string" minOccurs="0"/>
            <xs:element name="param8" type="xs:string" minOccurs="0"/>
            <xs:element name="param9" type="xs:string" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>

The code I wrote and I try to run is:

function conectarWS() {
    $wsdl = 'http://127.0.0.1:8888/appCodigosWS/appcodigos?wsdl';
    $client = new soapclient($wsdl, true);
    [...]
}
function generarCodigos() {
    $clienteWS = conectarWS();
    $request = array('tipoOperacion' => 1, 'param1' => "3", 'param2' => "", 'param3' => "",'param4' => "");
    $datosRequest = array('request' => $request);
    $response = $clienteWS->call('procesarPeticion', $datosRequest);
    return $response;
}

but when I use debug to inspect the request, the body is empty.

POST /appCodigosWS/appcodigos HTTP/1.0
Host: 127.0.0.1:8888
User-Agent: NuSOAP/0.9.5 (1.123)
Content-Type: text/xml; charset=ISO-8859-1
SOAPAction: ""
Content-Length: 418
<?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:ns9079="http://tempuri.org">
    <SOAP-ENV:Body>
        <procesarPeticion xmlns="http://appcodigos.yum.com/"/>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Any suggestion? I have tried to call the webservice from Java and it runs fine. Is there maybe any problem when importing de xsd?

Thank you!