Error SOAP - POSTMAN to ABL/4GL CODE

patelspam

New Member
Hi there!

I have a SOAP request in my postman that works perfectly

However, when I try to convert it to ABL/4GL code it doesn't work. I'm 100% doing something wrong but i can't seem to find it. I already talked to some colleagues of mine but nobody seems to find the problem.

I used the 'bprowsdldoc ' tool to get the following information:

(Only procedure/method found present in the .wsdl file)

1661414280388.png

1661414328651.png
Code i'm using:
Code:
    DEFINE VARIABLE hWebService              AS HANDLE   NO-UNDO.
    DEFINE VARIABLE hQdocWebService          AS HANDLE   NO-UNDO.
    DEFINE VARIABLE part                     AS LONGCHAR NO-UNDO.
    DEFINE VARIABLE processQdocMessageReturn AS LONGCHAR NO-UNDO.
    DEFINE VARIABLE err                      AS LOGICAL  NO-UNDO.
                  

    /* ************************  Function Prototypes ********************** */

    FUNCTION getBody RETURNS LONGCHAR (  ) FORWARD.
                                            
    /* ************************  Main                ********************** */
  
    CREATE SERVER hWebService.
                                                                        
    hWebService:CONNECT("-WSDL 'http://qad01.prifer.local:22079/qxi/services/QdocWebService?WSDL'") NO-ERROR.
  
    RUN QdocWebService SET hQdocWebService ON hWebService.
  
    part = getBody().
    RUN processQdocMessage IN hQdocWebService(INPUT part, OUTPUT processQdocMessageReturn) NO-ERROR.
                  
    /*ERRORS*/
    RUN ErrorInfo (OUTPUT err).
  
    PROCEDURE ErrorInfo: /*1*/
        DEFINE OUTPUT PARAMETER errorfound AS LOGICAL INITIAL FALSE.
        DEFINE VARIABLE i                AS INTEGER  NO-UNDO.
        DEFINE VARIABLE hSOAPFault       AS HANDLE   NO-UNDO.
        DEFINE VARIABLE hSOAPFaultDetail AS HANDLE   NO-UNDO.
        DEFINE VARIABLE HeaderXML        AS LONGCHAR VIEW-AS EDITOR SIZE 70 BY 15 LARGE.
      
        IF ERROR-STATUS:NUM-MESSAGES > 0 THEN
        DO:
            errorfound = TRUE.
            DO i = 1 TO ERROR-STATUS:NUM-MESSAGES:
                MESSAGE "Error " + STRING(i) + ": " + ERROR-STATUS:GET-MESSAGE(i) VIEW-AS ALERT-BOX.
            END.                               
            /*2*/
            IF VALID-HANDLE(ERROR-STATUS:ERROR-OBJECT-DETAIL) THEN
            DO:
                hSOAPFault = ERROR-STATUS:ERROR-OBJECT-DETAIL.
                MESSAGE
                  "Fault Code: "                            hSOAPFault:SOAP-FAULT-CODE                 SKIP 
                  "Fault SUBCode: "                         hSOAPFault:SOAP-FAULT-SUBCODE              SKIP
                  "Fault String: "                          hSOAPFault:SOAP-FAULT-STRING               SKIP
                  "Fault Actor: "                           hSOAPFault:SOAP-FAULT-ACTOR                SKIP
                  "Error Type: "                            hSOAPFault:TYPE                            SKIP
                  "Error FAULT-DETAIL: "                    hSOAPFault:SOAP-FAULT-DETAIL               SKIP
                  "Error FAULT-ROLE: "                      hSOAPFault:SOAP-FAULT-ROLE                 SKIP 
                  "Error SOAP-FAULT-MISUNDERSTOOD-HEADER: " hSOAPFault:SOAP-FAULT-MISUNDERSTOOD-HEADER
                  VIEW-AS ALERT-BOX
                        .
                /*3*/
                IF VALID-HANDLE(hSOAPFault:SOAP-FAULT-DETAIL) THEN
                DO:
                    hSOAPFaultDetail = hSOAPFault:SOAP-FAULT-DETAIL.
                    MESSAGE "Error Type: " hSOAPFaultDetail:TYPE VIEW-AS ALERT-BOX.
                    HeaderXML = hSOAPFaultDetail:GET-SERIALIZED().
                            
                    MESSAGE STRING(HeaderXML) VIEW-AS ALERT-BOX INFORMATION BUTTONS OK.
                /*DISPLAY HeaderXML LABEL "Serialized SOAP fault detail" WITH FRAME a.
                PAUSE. */
                END.
            END.
        END.
    END PROCEDURE.
 
    FUNCTION getBody RETURNS LONGCHAR (  ):
        RETURN
            '
<soapenv:Envelope xmlns:add="http://www.w3.org/2005/08/addressing"
  xmlns:qcom="urn:schemas-qad-com:xml-services:common"
  xmlns:qdoc="urn:schemas-qad-com:xml-services" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Header>
    <add:ReferenceParameters>
      <qcom:suppressResponseDetail>false</qcom:suppressResponseDetail>
    </add:ReferenceParameters>
    <add:MessageID/>
    <add:To>QADQXO</add:To>
    <add:Action/>
  </soapenv:Header>
  <soapenv:Body>
    <queryCostCentreRH xmlns="urn:schemas-qad-com:xml-services">
      <dsSessionContext xmlns="urn:schemas-qad-com:xml-services:common">
        <ttContext>
          <propertyQualifier>QAD</propertyQualifier>
          <propertyName>version</propertyName>
          <propertyValue>ERP3_1</propertyValue>
        </ttContext>
        <ttContext>
          <propertyQualifier>QAD</propertyQualifier>
          <propertyName>domain</propertyName>
          <propertyValue>PT10</propertyValue>
        </ttContext>
        <ttContext>
          <propertyQualifier>QAD</propertyQualifier>
          <propertyName>username</propertyName>
          <propertyValue>mfg</propertyValue>
        </ttContext>
        <ttContext>
          <propertyQualifier>QAD</propertyQualifier>
          <propertyName>password</propertyName>
          <propertyValue></propertyValue>
        </ttContext>
      </dsSessionContext>
      <dsQueryServiceRequest xmlns="urn:schemas-qad-com:xml-services">
        <QueryServiceRequest>
          <SourceApplication>QADERP</SourceApplication>
          <Profile>CostCentreRH</Profile>
          <Filter/>
          <MaxRows>0</MaxRows>
          <IgnoreBOFilter>false</IgnoreBOFilter>
          <IgnoreBOInnerJoin>false</IgnoreBOInnerJoin>
        </QueryServiceRequest>
      </dsQueryServiceRequest>
    </queryCostCentreRH>
  </soapenv:Body>
</soapenv:Envelope>
'.
    END FUNCTION.

Errors i get:
1661414902464.png
1661414827085.png

The postman doesn't have any header as well. I can paste it to other request or even SOAPUI and it works just fine.

I've already used this code to consume several SOAP services but the other ones were a lot simpler (ex: 1 string input, 1 logical output).

Can anyone find the error?
 

Attachments

  • 1661414346315.png
    1661414346315.png
    64.6 KB · Views: 2
  • 1661414556703.png
    1661414556703.png
    4.7 KB · Views: 2
  • 1661414565415.png
    1661414565415.png
    5.3 KB · Views: 1
  • 1661414572345.png
    1661414572345.png
    2.6 KB · Views: 1
  • 1661414581387.png
    1661414581387.png
    64.5 KB · Views: 1
Last edited:
Error 11506 you receive is all about SOAP-ENVELOPE and SOAP-BODY in the request. for more information check this out
FUNCTION getBody RETURNS LONGCHAR ( ):
RETURN '*COPY PASTE OF THE POSTMAN REQUEST BODY'.
END FUNCTION.

In your code example above, it's unclear what are you copying from postman (whether SOAP-ENVELOPE and SOAP-BODY also being copied?). if yes, Remove them and give a another try.
 
Error 11506 you receive is all about SOAP-ENVELOPE and SOAP-BODY in the request. for more information check this out


In your code example above, it's unclear what are you copying from postman (whether SOAP-ENVELOPE and SOAP-BODY also being copied?). if yes, Remove them and give a another try.
Hi there. I tried and it didn't work. I think i need the content that is in the body. Pls check the code again (the function). I talked with my superiors and I was able to share the postman request. See if it helps pls.
And let me know what body do you want me to try, I'll do it and give fast feedback
 
Body with content below should work (high level guess). this might need a small tweaks to handle the soap header part.

You can spend few hours to go through this link where you can find many examples where you can consume SOAP webservices from ABL with and without headers.

<queryCostCentreRH xmlns="urn:schemas-qad-com:xml-services">
<dsSessionContext xmlns="urn:schemas-qad-com:xml-services:common">
<ttContext>
<propertyQualifier>QAD</propertyQualifier>
<propertyName>version</propertyName>
<propertyValue>ERP3_1</propertyValue>
</ttContext>
<ttContext>
<propertyQualifier>QAD</propertyQualifier>
<propertyName>domain</propertyName>
<propertyValue>PT10</propertyValue>
</ttContext>
<ttContext>
<propertyQualifier>QAD</propertyQualifier>
<propertyName>username</propertyName>
<propertyValue>mfg</propertyValue>
</ttContext>
<ttContext>
<propertyQualifier>QAD</propertyQualifier>
<propertyName>password</propertyName>
<propertyValue></propertyValue>
</ttContext>
</dsSessionContext>
<dsQueryServiceRequest xmlns="urn:schemas-qad-com:xml-services">
<QueryServiceRequest>
<SourceApplication>QADERP</SourceApplication>
<Profile>CostCentreRH</Profile>
<Filter/>
<MaxRows>0</MaxRows>
<IgnoreBOFilter>false</IgnoreBOFilter>
<IgnoreBOInnerJoin>false</IgnoreBOInnerJoin>
</QueryServiceRequest>
</dsQueryServiceRequest>
</queryCostCentreRH>
 
Body with content below should work (high level guess). this might need a small tweaks to handle the soap header part.

You can spend few hours to go through this link where you can find many examples where you can consume SOAP webservices from ABL with and without headers.
Hey again.
I just tried it and it doesn't work. I get the same error.
Got any other body u want me to try?
I also wanted to ask if you know a way tro track the postman request so i could get the body of the request (the final one) that get's uses and compare it with the one going from this abl code.
 
Error 11506 you receive is all about SOAP-ENVELOPE and SOAP-BODY in the request. for more information check this out


In your code example above, it's unclear what are you copying from postman (whether SOAP-ENVELOPE and SOAP-BODY also being copied?). if yes, Remove them and give a another try.
Apparently you were correct. I used a program to see what was being sent frmo the postman and what was being sent from progress and i got the following:

POSTMAN
Code:
<soapenv:Envelope xmlns:add="http://www.w3.org/2005/08/addressing"
  xmlns:qcom="urn:schemas-qad-com:xml-services:common"
  xmlns:qdoc="urn:schemas-qad-com:xml-services" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Header>
    <add:ReferenceParameters>
      <qcom:suppressResponseDetail>false</qcom:suppressResponseDetail>
    </add:ReferenceParameters>
    <add:MessageID/>
    <add:To>QADQXO</add:To>
    <add:Action/>
  </soapenv:Header>
  <soapenv:Body>
    <queryCostCentreRH xmlns="urn:schemas-qad-com:xml-services">
      <dsSessionContext xmlns="urn:schemas-qad-com:xml-services:common">
        <ttContext>
          <propertyQualifier>QAD</propertyQualifier>
          <propertyName>version</propertyName>
          <propertyValue>ERP3_1</propertyValue>
        </ttContext>
        <ttContext>
          <propertyQualifier>QAD</propertyQualifier>
          <propertyName>domain</propertyName>
          <propertyValue>PT10</propertyValue>
        </ttContext>
        <ttContext>
          <propertyQualifier>QAD</propertyQualifier>
          <propertyName>username</propertyName>
          <propertyValue>mfg</propertyValue>
        </ttContext>
        <ttContext>
          <propertyQualifier>QAD</propertyQualifier>
          <propertyName>password</propertyName>
          <propertyValue></propertyValue>
        </ttContext>
      </dsSessionContext>
      <dsQueryServiceRequest xmlns="urn:schemas-qad-com:xml-services">
        <QueryServiceRequest>
          <SourceApplication>QADERP</SourceApplication>
          <Profile>CostCentreRH</Profile>
          <Filter/>
          <MaxRows>0</MaxRows>
          <IgnoreBOFilter>false</IgnoreBOFilter>
          <IgnoreBOInnerJoin>false</IgnoreBOInnerJoin>
        </QueryServiceRequest>
      </dsQueryServiceRequest>
    </queryCostCentreRH>
  </soapenv:Body>
</soapenv:Envelope>

PROGRESS
Code:
<SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body
        xmlns:s0="http://www.w3.org/2001/XMLSchema">
        <ns0:processQdocMessage
            xmlns:add="http://www.w3.org/2005/08/addressing"
            xmlns:qcom="urn:schemas-qad-com:xml-services:common"
            xmlns:qdoc="urn:schemas-qad-com:xml-services"
            xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
            xmlns:ns0="http://qdocs.qxtend.qad.com">
            <soapenv:Header>
                <add:ReferenceParameters>
                    <qcom:suppressResponseDetail>false</qcom:suppressResponseDetail>
                </add:ReferenceParameters>
                <add:MessageID/>
                <add:To>QADQXO</add:To>
                <add:Action/>
            </soapenv:Header>
            <soapenv:Body>
                <queryCostCentreRH
                    xmlns="urn:schemas-qad-com:xml-services">
                    <dsSessionContext
                        xmlns="urn:schemas-qad-com:xml-services:common">
                        <ttContext>
                            <propertyQualifier>QAD</propertyQualifier>
                            <propertyName>version</propertyName>
                            <propertyValue>ERP3_1</propertyValue>
                        </ttContext>
                        <ttContext>
                            <propertyQualifier>QAD</propertyQualifier>
                            <propertyName>domain</propertyName>
                            <propertyValue>PT10</propertyValue>
                        </ttContext>
                        <ttContext>
                            <propertyQualifier>QAD</propertyQualifier>
                            <propertyName>username</propertyName>
                            <propertyValue>mfg</propertyValue>
                        </ttContext>
                        <ttContext>
                            <propertyQualifier>QAD</propertyQualifier>
                            <propertyName>password</propertyName>
                            <propertyValue/>
                        </ttContext>
                    </dsSessionContext>
                    <dsQueryServiceRequest>
                        <QueryServiceRequest>
                            <SourceApplication>QADERP</SourceApplication>
                            <Profile>CostCentreRH</Profile>
                            <Filter/>
                            <MaxRows>0</MaxRows>
                            <IgnoreBOFilter>false</IgnoreBOFilter>
                            <IgnoreBOInnerJoin>false</IgnoreBOInnerJoin>
                        </QueryServiceRequest>
                    </dsQueryServiceRequest>
                </queryCostCentreRH>
            </soapenv:Body>
        </ns0:processQdocMessage>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Do you know how can i make progress not do this?
I also can't have "soap-env" instead of "soapenv" in the request. doesn't work if i try that in the postman....
 
Okay i got a TEMPORARY fix.
Apparently PROGRESS adds automatically the 'envelope' and 'body' to my request. but since it does that, it "destroys" what i want to send and makes it impossible(for now) to do it this way.
So i did the following:

Code:
DEFINE VARIABLE responseLCWSDL                          AS LONGCHAR  NO-UNDO.

PROCEDURE qad-POST:
    DEFINE INPUT PARAMETER inputWSDL AS CHARACTER NO-UNDO.
    
    DEFINE VARIABLE oRequest   AS OpenEdge.Net.HTTP.IHttpRequest  NO-UNDO.
    DEFINE VARIABLE oResponse  AS OpenEdge.Net.HTTP.IHttpResponse NO-UNDO.
    DEFINE VARIABLE hXMLHandle AS HANDLE                          NO-UNDO.

    oRequest = OpenEdge.Net.HTTP.RequestBuilder:Post("-WSDL '":U + inputWSDL + "?WSDL'":U, qad-getQueryCostCentreRHBody())
                         :ContentType('text/xml;charset=UTF-8':U)
                         :AcceptAll()
                         :AddHeader('SOAPAction':U, '"#POST"':U)
                         :REQUEST NO-ERROR.

    oResponse = OpenEdge.Net.HTTP.ClientBuilder:Build():Client:Execute(oRequest) NO-ERROR.
    IF oResponse:StatusCode <> 200 THEN
    DO:
        MESSAGE "http error: ":U oResponse:StatusCode VIEW-AS ALERT-BOX.
        RETURN "error":U.
    END.
    
    hXMLHandle = CAST(oResponse:Entity,OpenEdge.Core.WidgetHandle):VALUE NO-ERROR.
    hXMLHandle:SAVE('LONGCHAR':U,responseLCWSDL) NO-ERROR.
END PROCEDURE.

Since i couldn't map it correclty (because of the scuffed tags the XML is using) i then created a dynamic DATASET and used 'READ-XML' with the longchar i get from the response. Then i loop the records and then I can do what i want with the data.
This last part might get a bit slow but i already tried with a XML file with more than 70k lines and only took about 2seconds (and it was in a over-used server, so it's not bad at all).

If anyone happens to encounter this error and happens to fix it the normal way please let me know.

Thanks again.
 
Back
Top