[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: using the response from one service to make another request- need a little Guidance



Thanks Scott.  That helps.  My mistakes are out of ignorance, I've completed several task in this project using your stuff to communicate with their webservices with few problems until this task, the first asking me to send back data that was received.
 the namespace (web:) I assumed that needed to be added based on the results from soapui when I create a default request.

>From what worked with soapUI creating a default request
</soapenv:Header>
   <soapenv:Body>
      <web:UpdateRequest>
         <!--Optional:-->
         <web:reqData>
            <web:RequestId>824748</web:RequestId>

The results in soapUI from the first request did not have the namespace.

<GetRequestByRequestIdResult>
            <RequestId>824748</RequestId>
            <DomainId>1</DomainId>
            <ProjectSid>-9999</ProjectSid>
            <ProblemCode>CONNECT SERVICE</ProblemCode>


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Wednesday, May 13, 2009 6:10 PM
To: HTTPAPI and FTPAPI Projects
Subject: Re: using the response from one service to make another request- need a little Guidance

There are two different events under which HTTPAPI can call your
subprocedures:

    a) XML start elements.
    b) XML end elements.

The former is called when the start tag is found in the XML data.  For
example, <soap:Envelope>.  Since the data that's inside the XML element
has not yet been read, no "value" parameter is passed.  So the
parameters are Userdata, depth, name, path and attributes.

The latter is called when the end tag is found, for example,
</soap:Envelope>.  At this point, it has already read all of the data
inside the XML document, so it knows what the character data will be,
and thus gets the extra parameter named "value"...    UserData, depth,
name, path, value and attrs are passed.

Your problem is that you're passing *NULL for the start handler, so
HTTPAPI isn't calling anything for your start elements, only for your
end elements.  That'll make it extremely difficult to reconstruct your
XML document.

Furthermore...  HTTPAPI's XML parser is intended to be simple, not
feature-rich.  It does not give you all of the information that's in the
incoming XML document.  For example, it doesn't tell your program what
the encoding was, or XML version.

If you really want to faithfully recreate the XML document, I suggest
calling Expat directly instead of using HTTPAPI's interface.  It'll be
more work, but you'll have much more control.  Or, alternately, use XML-SAX.

Depending on your project, though, it might be simpler to load the XML
data into a character string and perform %SCAN/%REPLACE on it rather
than trying to completely reconstruct it.

Furthermore, I don't understand why you're adding "web:" to the XML
elements.  This is resulting in you having elements with multiple
namespaces (such as <web:soap:Envelope>) which is not legal.  why are
you doing that?


Harold Blevins wrote:
> Making some progress
> At the suggestion of a friend I'm moving the results into an array, then using that to post to the other webservice
>
> I'm ending up with the headers at the end (see debug).  How can I populate the array with the headers in the correct sequence or removed?
>
> </web:CustomerCallData>
> <web:CustomerCalls>
> </web:CustomerCalls>
> <web:GetRequestByRequestIdResult>
> </web:GetRequestByRequestIdResult>
> <web:GetRequestByRequestIdResponse>
> </web:GetRequestByRequestIdResponse>
> <web:soap:Body>
> </web:soap:Body>
> <web:soap:Envelope>
> </web:soap:Envelope>
>
>
>
>     http_xproc( HTTP_POINT_ADDL_HEADER
>                  : %paddr(Add_SOAPACTION) );
>
>        rc = http_url_post_xml(
>                   'http://10.1.1.15/cwwebservices/CityworksWebService.asmx'
>                          : %addr(SOAP) + VARYINGDATAOFFSET
>                          : %len(SOAP)
>                          : *NULL
>                          : %paddr(MapXmlData)
>                          : %addr(UserData)
>                          : HTTP_TIMEOUT
>                          : HTTP_USERAGENT
>                          : 'text/xml; charset=UTF-8' );
>      P MapXmlData      B
>      D MapXmlData      PI
>      D   UserData                      *
>      D   depth                       10I 0 value
>      D   name                      1024A   varying const
>      D   path                     24576A   varying const
>      D   value                    65535A   varying const
>      D   attrs                         *   dim(32767)
>      D                                     const options(*varsize)
>
> /free
>
>        Select;
>
>          When name <> 'Status';
>          x=x+1;
>          RECX(x) = '<web:' + %trim(name) + '>' +
>                    %trim(value) + '</web:' + %trim(name) + '>';
>
>          When name = 'Status';
>          x=x+1;
>          RECX(x) = '<web:' + %trim(name) + '>Closed' +
>                    '</web:' + %trim(name) + '>';
>
>        Endsl;
>
>       /end-free
>
>
> ------------------------------------------------------------------------
>
> -----------------------------------------------------------------------
> This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> -----------------------------------------------------------------------

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------