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

Re: Need help adjusting a WSDL2RPG stub program



Michael,

The problem that you reported was a pretty tough one, at least for a person that just returned from vacation.

The problem is that 'value' is defined as 'anyType' which means, that the server can send back any kind of xml:

   <complexType name="mapItem">
    <sequence>
     <element name="key" nillable="true" type="xsd:anyType"/>
     <element name="value" nillable="true" type="xsd:anyType"/>
    </sequence>
   </complexType>

In your case the server even returned a complex type, namely a map. As a best guess WSDL2RPG assumes that 'anyType' is a simple type and hence it uses a string for it. Of course there is no chance to store a map in a string.

Honestly I hate web services using 'anyType' because there is no chance for any developer to know what the server returns until he sees the real response message. Or do you know what you will get when your wife says: "I will give you a present (= something) at Christmas"? ;-)

So the question is: What to do with that web service?

Since we know what we get back from the service (because we saw the response in the debug log), the easiest way to fix the problem is to change the wsdl file. That is what I did for you. Please have a look at the zip file where you find the following items:

Original version:

   WS3PRVSN.rpgle
   WS3PRVSN01.rpgle
   WS3TEST.rpgle
   Provision3.wsdl (the one you sent to me)

Modified version ('anyType' has been changed to 'AnyMap'):

   WS4PRVSN.rpgle
   WS4PRVSN01.rpgle
   WS4TEST.rpgle
   Provision4.wsdl

Of course everything gets broken again if someone at the server side considers to change the response to whatever else. From the point of the wsdl file he even could do that without violating the wsdl file (the contract of the web service). But as mentioned before, no developer and no program can foresee, what the web service might return in the future. So every program, whether it is Java or RPG, will crash in that case.

Regards,

Thomas.


Am 30.07.2012 18:59, schrieb Koester, Michael:
Sorry I misunderstood.  Thanks for clarifying for me.
-- Michael

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Thomas Raddatz
Sent: Monday, July 30, 2012 12:38 PM
To: HTTPAPI and FTPAPI Projects
Subject: Re: Need help adjusting a WSDL2RPG stub program

Michael,

The wsdl file is the contract of the web service. Please enter the URL of the wsdl file into your preferred web browser and then use "Save as" to create a local copy of that file and send it to me.

I need the wsdl file to generate the stub and to set up a soapUI mock web service which I can use to return the data of your debug log. This way I can test the stub with the very same data that you received from your web service.

The URL of the wsdl file is what you entered at keyword URL of command WSDL2RPG, e.g.:

     WSDL2RPG
        URL('http://www.webservicex.net/CurrencyConvertor.asmx?WSDL')
        ...

Thomas.

Am 30.07.2012 14:08, schrieb Koester, Michael:
Hey Thomas -- welcome back.  Hope you had a great vacation!
If I understand what you're asking for, I've cut the resulting xml from an interface I'll be trying to mimic.  That same data comes through in the debug log I attached to an earlier post, but I'll attach that here as well.
If you haven't yet seen the other attachments, they are on my first post on July 26.  If you need me to resend those, I will be happy to.

Thanks for your time, Thomas.
-- Michael

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Thomas
Raddatz
Sent: Sunday, July 29, 2012 12:38 PM
To: HTTPAPI and FTPAPI Projects
Subject: Re: Need help adjusting a WSDL2RPG stub program

Michael,

Sorry for the late reply. I was on vacation and returned this weekend.
Please post the wsdl file to help me to set up a soapUI mock service. For whatever reasons the stub does not notice the multiref element "id1". I need to debug that.

Thomas.

Am 26.07.2012 20:02, schrieb Koester, Michael:
Mike, your instincts of where to look are pretty impressive.  I did find that I had limited the definition of the ds, "item" (nested in ds, "impl_item_of_anyType_t" in the Base stub) to DIM_A2 instead of DIM_A3.  Fixed that, recreated the module and the *srvpgm, recreated the test caller *pgm, ended and restarted my test session, and tried it.  Crashed at the same place as before: "failed to retrieve multi-reference information of ID 'id1'" in the parsing routines.

Good catch, though.  That would have bitten me shortly after I get past the parsing issue.  Other than initializing, that is the only reference to DIM_A3 I'm aware of.

-- Michael Koester

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Mike
Krebs
Sent: Thursday, July 26, 2012 1:16 PM
To: HTTPAPI and FTPAPI Projects
Subject: RE: Need help adjusting a WSDL2RPG stub program

Okay, sounds reasonable. Should the stub or the method have a reference to DIM(DIM_A3) someplace? Or does that magic happen someplace else?

________________________________________
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Koester, Michael
[mkoester@xxxxxxxxxxxxx]
Sent: Thursday, July 26, 2012 11:03 AM
To: HTTPAPI and FTPAPI Projects
Subject: RE: Need help adjusting a WSDL2RPG stub program

Hi Mike.  In this particular case there are 24 key/value pairs.  The stubs are soft-coded to permit that flexibility, and the arrays are dimensioned to handle whatever was entered on the WSDL2RPG prompt.  For handling the multi-ref stuff, I was advised to manually set DIM_A3 to 256, so that there could be up to that many key/value pairs.  This is in the Base Stub.  That way, other methods (operations) that use that same web service can also have up to that many.

-- Michael Koester

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Mike
Krebs
Sent: Thursday, July 26, 2012 11:44 AM
To: HTTPAPI and FTPAPI Projects
Subject: RE: Need help adjusting a WSDL2RPG stub program

I don't know WSDL2RPG at all...
You have 24 key/value pairs...shouldn't you have a dim for 24 someplace?

________________________________________
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Koester, Michael
[mkoester@xxxxxxxxxxxxx]
Sent: Thursday, July 26, 2012 9:43 AM
To: HTTPAPI and FTPAPI Projects
Subject: RE: Need help adjusting a WSDL2RPG stub program

Got no responses from my plea for help last week, but I've continued and got just a bit closer, I think.  Still stuck, though.  I had some help from Thomas for something similar several months ago, so I re-jiggered the stubs (both base and method) to be more like the one I have in production that deals with the multi-ref layer.
Still seeing the data returned from the web service in the debug log, but parsing blows up when called from procedure,"HTTP_receiveResponse":
    "if (XMLSAXParser_parse(g_hSAXParser: i_data: i_length) = cTrue);"  [returns FALSE] Possibly because of one or more of the following:
1) The web service is returning something non-standard, or
2) I messed up the stub programs when I tried to adapt for multi-ref
handling, or
3) Additional tweaks are needed (which I would need assistance with,
because I'm quite over my head as it is.)

Attached .txt files are BaseStub (RPG source WS2PRVSN), MethodStub (RPG source WS2PRVSN03), TestCaller (RPG source WS2GETDEVC), and the debug log.  Note that these are a bit different than those I attached to earlier posts.

Many thanks.
-- Michael Koester
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Koester,
Michael
Sent: Thursday, July 19, 2012 11:48 AM
To: HTTPAPI and FTPAPI Projects
Subject: Need help adjusting a WSDL2RPG stub program

I used WSDL2RPG (the Thomas Raddatz tool) to generate a base stub WS_PRVSN, a method stub WS_PRVSN03, and a test caller program, WS_GETDEVC.   My test caller program WS_GETDEVC, sends two inputs to the webservice.  For those values sent I expect to get 24 key/value pairs returned.  The debug log shows that all key/value pairs were returned by the webservice -- the stub just isn't parsing them out correctly.

The webservice appears to be sending back 24 key/value pairs, but they appear to be within a <multiRef ... </multiRef> set. The method stub does not appear to have the routines for parsing out the "MultiRef" layer.

Is there an easy way to fix the stub so that it ignores the outer group and just loads the data structure from the inner group of key/value pairs?

I can't directly share the access to the webservice (it's all on the private side of the firewall, and it pertains to customer-proprietary data), but hopefully the attachments should provide what you may need.

Thanks much.
Michael Koester
---------------------------------------------------------------------
-
- 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
---------------------------------------------------------------------
-
-
---------------------------------------------------------------------
-
- 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
----------------------------------------------------------------------
-

-----------------------------------------------------------------------
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
-----------------------------------------------------------------------