Question Param to webservice

nicolas

Member
Hello

I'm trying to use a web service, which receives several parameters.
and connects to the webservice, and connects to the port, but consumes the web service error indicates a missing parameter.

the connection to the function you want to use the well performed:

Code:
CREATE SERVER hServer.
lReturn = hServer:CONNECT("-WSDL url_wsdl
                          -nohostverify").
RUN Nombre_ManagerPort SET hPortType ON SERVER hServer.
RUN requestFuncion IN hPortType (INPUT param0, OUTPUT wsOutput) NO-ERROR.

where param0 is a string that contains only one variable.


The request of the function is as follows:

HTML:
1.    <?xml version="1.0" encoding="UTF-8"?>
2.    <env:Envelope xmlns:env="url" xmlns:ns1="url" xmlns:xsd="url" xmlns:xsi="url" xmlns:enc="url">
3.  
4.    <env:Body>
5.      <ns1:requestFuncion env:encodingStyle="url">
6.        <param0 xsi:type="enc:Struct">
7.          <UserPass xsi:type="xsd:string">111111</UserPass>
8.          <UserID xsi:type="xsd:string">111111</UserID>
9.          <emisorRFC xsi:type="xsd:string">RFC</emisorRFC>
10.          <text xsi:type="xsd:string">Cadena</text2CFDI>
14.        </param0>
15.      </ns1:requestFuncion>
16.    </env:Body>
17.    </env:Envelope>


The error I received indicates that the parameter is not emisorRFC, which is correct.

How sending this parameter to webservice?
 
Last edited:

Stefan

Well-Known Member
Put code inside [ code ] tags please.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="url" xmlns:ns1="url" xmlns:xsd="url" xmlns:xsi="url" xmlns:enc="url">
  <env:Body>
    <ns1:requestFuncion env:encodingStyle="url">
      <param0 xsi:type="enc:Struct">
        <UserPass xsi:type="xsd:string">111111</UserPass>
        <UserID xsi:type="xsd:string">111111</UserID>
        <emisorRFC xsi:type="xsd:string">RFC</emisorRFC>
        <text xsi:type="xsd:string">Cadena</text2CFDI> /* <--- this is incorrect XML */
      </param0>
    </ns1:requestFuncion>
  </env:Body>
</env:Envelope>

param0 is not a single character but a structure - is your code the result of using the bprowsdldoc analyzer on your wsdl?

Since your XML contains typos - can you provide the actual WSDL?

You /may/ be able to pass a temp-table handle as structure.
 

nicolas

Member
Sorry, do not understand how to pass parameters to webservice as a table can give me an example.

SOAP request in XML format to consume requestTimbrado method with SOAP 1.2 is as follows:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http: //www.w3.org/2003/05/soap-envelope" xmlns:ns1="https: //dominio.com/tim/soap" xmlns:xsd="http: //www.w3.org/2001/XMLSchema" xmlns:xsi="http: //www.w3.org/2001/XMLSchema-instance" xmlns:enc="http: //www.w3.org/2003/05/soap-encoding">
  <env:Body>
    <ns1:requestTimbrado env:encodingStyle="http: //www.w3.org/2003/05/soap-encoding">
      <param0 xsi:type="enc:Struct">
        <UserPass xsi:type="xsd:string">usuario</UserPass>
        <UserID xsi:type="xsd:string">password</UserID>
        <emisorRFC xsi:type="xsd:string">RFC</emisorRFC>
        <text2c xsi:type="xsd:string">cadenaCodificadoBase64</text2c>
      </param0>
    </ns1:requestTimbrado>
  </env:Body>
</env:Envelope>

a table defined as follows

Code:
DEFINE TEMP-TABLE datosRequest XML-NODE-NAME "requestTimbrado"
    FIELD vUserPass AS CHAR XML-NODE-NAME "UserPass"
    FIELD vUserID AS CHAR XML-NODE-NAME "UserID"
    FIELD vemisorRFC AS CHAR XML-NODE-NAME "emisorRFC"
    FIELD vtext2C AS CHAR XML-NODE-NAME "text2c"
    INDEX indexRequest IS PRIMARY vemisorRFC ASCENDING .

the attempt to pass as follows and tells me the same error.

Code:
RUN requestTimbrado IN hPortType (INPUT TABLE datosRequest, OUTPUT wsOutput) NO-ERROR.

could you give me an example
 

Stefan

Well-Known Member
The WSDL only defines a string input parameter and a string output parameter. The back-end of the web service is then complaining that the input is formatted incorrectly. Which would never have been an issue if the WSDL actually defined the web service instead of defining a thing as input which is specified elsewhere.

If I pass the following:

Code:
DEFINE VARIABLE hWebService AS HANDLE NO-UNDO.
DEFINE VARIABLE hTimbrado_ManagerPort AS HANDLE NO-UNDO.

CREATE SERVER hWebService.

hWebService:CONNECT("-WSDL 'https://<server>/timbrado/wsdl'").

RUN Timbrado_ManagerPort SET hTimbrado_ManagerPort ON hWebService.

DEFINE VARIABLE request AS LONGCHAR NO-UNDO.
DEFINE VARIABLE return1 AS LONGCHAR NO-UNDO.

assign
    request    =   "<Param0>"
                +   "<UserPass>b9ec2afa3361a59af4b4d102d3f704eabdf097d4</UserPass>"
                +   "<UserID>UsuarioPruebasWS</UserID>"
                +   "<emisorRFC>the sender RFC file content</emisorRFC>"
                +   "<text2CFDI>Base64 encoded file</text2CFDI>"
                +   "</Param0>"                 .


RUN requestTimbrarCFDI IN hTimbrado_ManagerPort(INPUT request, OUTPUT return1).

MESSAGE STRING( return1 ) VIEW-AS ALERT-BOX.

I do get a different response than the simple fatal - probably due to the contents of my text2CFDI not actually being a Base64 - but my spanish is limited to 'cerveza por favor' ;-)

Note that the above is generated by bprowsdldoc with 11.3. I notice on the site that the web service is SOAP 1.2 - I know that pre 11.3 SOAP 1.1 is used for Progress generated web services, not sure about consuming them.
 

nicolas

Member
The input variable of the method requestTimbrado tells me it's a chain, but the webservice considered as an object. is, that input parameter should contain 4 variables.
I tried to send the xml soap and still shows errors.

The error tells me are: 11506, 247 and 198.

May be the form in which it passes the entry paramtro method. but I have no idea how to track it or know it is not sent correctly. can help.
 

Stefan

Well-Known Member
Hmm... not sure what they are expecting. Can you use on of their other example connections (in another language)? Use fiddler (there's a link on their page too) to examine the message being sent and compare it with the message being sent by the progress web service call?
 

nicolas

Member
After reviewing with other programs to use the send method, I got the following:

Code:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="https://server/timbrado/soap">
  <soapenv:Header/>
  <soapenv:Body>
      <soap:requestTimbrarCFDI soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        <request xsi:type="xsd:anyType"><UserPass>user</UserPass><UserID>pass</UserID><emisorRFC>rfc</emisorRFC><text2CFDI>CadenaCodificada</text2CFDI></request>
      </soap:requestTimbrarCFDI>
  </soapenv:Body>
</soapenv:Envelope>

The bprowsdldoc tells me the following:

Code:
DEFINE VARIABLE request AS LONGCHAR NO-UNDO.
DEFINE VARIABLE return1 AS LONGCHAR NO-UNDO.

RUN requestTimbrarCFDI IN hTimbrado_ManagerPort(INPUT request, OUTPUT return1).

where:

request: This value is defined as an XML Schema anyType value.

How should I pass the request parameter to the method requestTimbrarCFDI?

I've tried to spend as string as xml (serialized) but I still reported as missing the RFC.
 
Last edited:

Stefan

Well-Known Member
1. Use one of the other languages on their developer site, inspect what is being sent with fiddler and compare the fiddler result of what you are passing.
2. Ask modern invoicing to provide a normally well defined web service instead of a generic put some crap in this string web service.
 

Stefan

Well-Known Member
Installed Fiddler and SoapUI.
Was unable to get SoapUI to play nicely with Fiddler.
Was able to get Progress to play nicely with Fiddler after importing the self signed Fiddler certificate with certutil (and adding -format DER).
Progress client started with additional parameters -proxyhost 127.0.0.1 -proxyport 8888 -nohostverify (yes, never use in real life)

The interesting part is that Fiddler shows that the Progress client is stripping the XML tags off the request and only passing the value of the first input, so even when the input for longchar is:

Code:
   request  =  "<UserPass>b9ec2afa3361a59af4b4d102d3f704eabdf097d4</UserPass>"
            +  "<UserID>UsuarioPruebasWS</UserID>"
            +  "<emisorRFC>ESI920427886</emisorRFC>"
            +  "<text2CFDI>cadena64</text2CFDI>"
            +  "<generarPDF>true</generarPDF>"
            .

Only the value of UserPass is being passed as input:

Code:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s0="http://www.w3.org/2001/XMLSchema">
<ns0:requestTimbrarCFDI xmlns:ns0="https://t1demo.facturacionmoderna.com/timbrado/soap">
<request>b9ec2afa3361a59af4b4d102d3f704eabdf097d4</request>
</ns0:requestTimbrarCFDI>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
 

nicolas

Member
Thanks for the help.

Apparently the problem is to send the characters "<"and ">", progress not sent properly or discarded.

I'm trying to generate complete and send soap.
at least now I have idea that is sent, because I could not make it work the proxy to monitor my output.

thank you very much
 

Stefan

Well-Known Member
You are welcome. I thought about what is going on a bit more and Progress is actually helping you, it is automatically escaping < and > since the input parameter is considered a string so should not be passing < and > which would alter the XML message.

You may (not sure) be able to point to a local customized wsdl which actually defines the inputs correctly - but I've had enough of this poorly defined wsdl for now.
 
Top