3
I’m trying to perform a SOAP request on http://www.ieptb.com.br/ws/serverTabelionatos.php.
However I am not able to successfully complete the request. The only information you provide me is:
Name: consulta_cenprot
Binding: serverTabelionatosBinding
Endpoint: http://www.ieptb.com.br/ws/serverTabelionatos.php
SoapAction: urn:serverTabelionatos#consulta
Style: rpc
Input:
use: encoded
namespace: urn:serverTabelionatos
encodingStyle: http://schemas.xmlsoap.org/soap/encoding/
message: consulta_cenprotRequest
parts:
tipo_doc: xsd:string
documento: xsd:string
Output:
use: encoded
namespace: urn:serverTabelionatos
encodingStyle: http://schemas.xmlsoap.org/soap/encoding/
message: consulta_cenprotResponse
parts:
return: xsd:string
Namespace: urn:serverTabelionatos
Transport: http://schemas.xmlsoap.org/soap/http
Documentation: Realiza a consulta de um documento na base de dados
The requisition I’m trying to accomplish is as follows
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://www.ieptb.com.br/ws/serverTabelionatos.php",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "\r\n<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n<definitions 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:tns=\"urn:serverTabelionatos\" xmlns:soap=\"http://schemas.xmlsoap.org/wsdl/soap/\" xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\" xmlns=\"http://schemas.xmlsoap.org/wsdl/\" targetNamespace=\"urn:serverTabelionatos\">\r\n<types>\r\n<xsd:schema targetNamespace=\"urn:serverTabelionatos\"\r\n>\r\n <xsd:import namespace=\"http://schemas.xmlsoap.org/soap/encoding/\" />\r\n <xsd:import namespace=\"http://schemas.xmlsoap.org/wsdl/\" />\r\n <xsd:complexType name=\"vEstados\">\r\n <xsd:complexContent>\r\n <xsd:restriction base=\"SOAP-ENC:Array\">\r\n <xsd:attribute ref=\"SOAP-ENC:arrayType\" wsdl:arrayType=\"tns:vEstados[]\"/>\r\n </xsd:restriction>\r\n </xsd:complexContent>\r\n </xsd:complexType>\r\n</xsd:schema>\r\n</types>\r\n\r\n<message name=\"consulta_cenprotRequest\">\r\n <part name=\"tipo_doc\" type=\"xsd:string\" default=\"CPF\" />\r\n <part name=\"documento\" type=\"xsd:string\" default=\"CPF AQUI\" /></message>\r\n<portType name=\"serverTabelionatosPortType\">\r\n <operation name=\"consulta_cenprot\">\r\n <documentation>Realiza a consulta de um documento na base de dados</documentation>\r\n <input message=\"tns:consulta_cenprotRequest\"/>\r\n <output message=\"tns:consulta_cenprotResponse\"/>\r\n </operation>\r\n</portType>\r\n<binding name=\"serverTabelionatosBinding\" type=\"tns:serverTabelionatosPortType\">\r\n <soap:binding style=\"rpc\" transport=\"http://schemas.xmlsoap.org/soap/http\"/>\r\n <operation name=\"consulta_cenprot\">\r\n <soap:operation soapAction=\"urn:serverTabelionatos#consulta\" style=\"rpc\"/>\r\n <input><soap:body use=\"encoded\" namespace=\"urn:serverTabelionatos\" encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"/></input>\r\n <output><soap:body use=\"encoded\" namespace=\"urn:serverTabelionatos\" encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"/></output>\r\n </operation>\r\n</binding>\r\n<service name=\"serverTabelionatos\">\r\n <port name=\"serverTabelionatosPort\" binding=\"tns:serverTabelionatosBinding\">\r\n <soap:address location=\"http://www.ieptb.com.br/ws/serverTabelionatos.php\"/>\r\n </port>\r\n</service>\r\n</definitions>",
CURLOPT_HTTPHEADER => array(
"cache-control: no-cache",
"content-type: application/xml",
"postman-token: 7b5507d8-5af4-a2c2-2831-991f3f313ac8"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
The XML of the request is as follows:
<?xml version="1.0" encoding="ISO-8859-1"?>
<definitions 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:tns="urn:serverTabelionatos" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:serverTabelionatos">
<types>
<xsd:schema targetNamespace="urn:serverTabelionatos"
>
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
<xsd:complexType name="vEstados">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:vEstados[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
</types>
<message name="consulta_cenprotRequest">
<part name="tipo_doc" type="xsd:string" default="CPF" />
<part name="documento" type="xsd:string" default="CPF AQUI" /></message>
<portType name="serverTabelionatosPortType">
<operation name="consulta_cenprot">
<documentation>Realiza a consulta de um documento na base de dados</documentation>
<input message="tns:consulta_cenprotRequest"/>
<output message="tns:consulta_cenprotResponse"/>
</operation>
</portType>
<binding name="serverTabelionatosBinding" type="tns:serverTabelionatosPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="consulta_cenprot">
<soap:operation soapAction="urn:serverTabelionatos#consulta" style="rpc"/>
<input><soap:body use="encoded" namespace="urn:serverTabelionatos" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
<output><soap:body use="encoded" namespace="urn:serverTabelionatos" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
</operation>
</binding>
<service name="serverTabelionatos">
<port name="serverTabelionatosPort" binding="tns:serverTabelionatosBinding">
<soap:address location="http://www.ieptb.com.br/ws/serverTabelionatos.php"/>
</port>
</service>
</definitions>
The error that is returning is as follows:
<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
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/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode xsi:type="xsd:string">SOAP-ENV:Client</faultcode>
<faultactor xsi:type="xsd:string"></faultactor>
<faultstring xsi:type="xsd:string">Operation '' is not defined in the WSDL for this service</faultstring>
<detail xsi:type="xsd:string"></detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The answer gets much better when the guy understands PHP :)
– nullptr
No doubt very good clarification
– Renato Junior