ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

integrated web services server - IWS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • integrated web services server - IWS

    Hi ,

    I am trying to consume external web services "http://www.webserviceX.NET/CurrencyConvertor.asmx" in rpg program for currency conversion.

    We followed the below steps
    1. First generated C stubs using WSDL2SH tool from the WSDL file(attached the WSDL for the reference).
    2. Tool generated C stubs Currency.C and CurrencyConvertorSoap.C only (but in Integrated Web service for i help from IBM,it has been mentioned that, it will generate C-stubs for input, port and result.....??????)
    3. Created C objects using CRTCMOD using the stubs
    4. Created RPG module (attached for reference) to consume web service
    5. Created Program by binding RPG module and C module

    If we call the program, we couldn't able to get the results , returned XML string is having some junk values. Attached the error also.

    Please help us to resolve this issue

    Thanks in advance
    Attached Files

  • #2
    Re: integrated web services server - IWS

    please submit questions in a single thread instead of opening multiple threads for the same question. it becomes unmanageable & is a real pain for those trying to help having to jump through multiple threads, etc.
    I'm not anti-social, I just don't like people -Tommy Holden

    Comment


    • #3
      Re: integrated web services server - IWS

      Sorry for submitting multiple time , since this is the first time I am posting thread in code400, I didn’t realize whether it's submitted or not. I initially thought it was not submitted, so I did again.... Sorry again for the inconvenience

      Comment


      • #4
        Re: integrated web services server - IWS

        You are passing it a currency value of "USD ", and it says that "USD " is not a valid currency. You might try trimming the currency value to remove the blanks and try it again.
        Michael Catalani
        IS Director, eCommerce & Web Development
        Acceptance Insurance Corporation
        www.AcceptanceInsurance.com
        www.ProvatoSys.com

        Comment


        • #5
          Re: integrated web services server - IWS

          check the Log file axis.log for the input & output soap message..

          Comment


          • #6
            Re: integrated web services server - IWS

            Hi Dhanuxp,

            Can you help me with the path for Axis.log to check input and output soap messages

            Thanks in advance

            Comment


            • #7
              Re: integrated web services server - IWS

              You have to configure..... configurable path is in /qibm/ProdData/OS/WebServices/V1/client/etc/axiscpp.conf

              change it as bellow..
              # The comment character is '#'
              # Available directives are as follows
              #
              # ClientWSDDFilePath: The path to the client WSDD
              # SecureInfo: The GSKit security information
              #

              ClientLogPath:/tmp/axis.log
              Last edited by dhanuxp; June 5, 2012, 11:09 PM.

              Comment


              • #8
                Re: integrated web services server - IWS

                Thanks for you reply,

                In the axis.cpp , its showing the following details only..
                # The comment character is '#'
                # Available directives are as follows
                #
                # ClientWSDDFilePath: The path to the client WSDD
                # SecureInfo: The GSKit security information
                #

                how to cofigure to log the errors in that ??

                Comment


                • #9
                  Re: integrated web services server - IWS

                  edit the file and add following line to end of the file...

                  Code:
                  ClientLogPath:/tmp/axis.log
                  then save it.. run your WS client program..
                  you can see the logs in axis.log file in /tmp directory
                  examine the request & response message...

                  how's req/res soap message looks like?
                  Last edited by dhanuxp; June 6, 2012, 01:46 AM.

                  Comment


                  • #10
                    Re: integrated web services server - IWS

                    Thank you, now i can able to see the log.....
                    Its send's the reponse and getting it back in XML in log file, but the rpg program, couldnt receive the value properly...

                    Response in Axis.log file:
                    <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><ConversionRateResponse xmlns="http://www.webserviceX.NET/"><ConversionRateResult>55.445</ConversionRateResult></ConversionRateResponse></soap:Body></soap:Envelope>

                    But in rpg program, the above value is not reflecting, program not receiving proper xml in the string for parsing.

                    Declared variable to receive the return value as below in RPG program
                    D xmldoc S *
                    D xmlstr S 9999A based(xmldoc)

                    Is that the right way to declare the variable to receive the return value??

                    Comment


                    • #11
                      Re: integrated web services server - IWS

                      I've only had a brief moment to look at this, but I think your problem is that your C program is appending a null after the from currency. (inserting a null terminated string into the xml) This is probably why the error says that "USD " is not a valid currency. The currency should read "USD". The blank at the end is likely a null character.
                      Last edited by MichaelCatalani; June 6, 2012, 06:14 PM.
                      Michael Catalani
                      IS Director, eCommerce & Web Development
                      Acceptance Insurance Corporation
                      www.AcceptanceInsurance.com
                      www.ProvatoSys.com

                      Comment


                      • #12
                        Re: integrated web services server - IWS

                        Ok. WebService returns correct values. that means your request message is correct...!!!

                        shall we simplify this ?
                        can you change your code (inside the monitor statement) like this. Debug it & check what you received to tst_xml variable...
                        Code:
                        D tst_xml         S           9999A
                        Code:
                          Monitor;
                        		if (xmldoc <> *Null );
                                     //xml-into currency %xml( xmlstr );
                        		tst_xml = %str(xmldoc);
                        		else;
                        		msg = 'No data..';
                        		endif;
                        
                                   On-Error;
                        Last edited by dhanuxp; June 7, 2012, 12:16 AM.

                        Comment


                        • #13
                          Re: integrated web services server - IWS

                          I tried as you mentioned ,the value in that string:


                          ....5...10...15...20...25...30...35...40...45...50 ...55...60
                          1 'Ø '
                          61 ' '
                          21 ' '
                          81 ' '
                          41 ' '

                          But the C stub returns the proper value "Ret = 7.928500000000E+001" (for currency conversion from USD to JPY), only the RPG program couldnt able to receive.

                          The declaration is as follows:

                          D* Pointer to point to string xmlstr which will contain XML doc
                          D xmldoc S *
                          D xmlstr S 9999A

                          Code :

                          xmldoc = ConversionRate(CurCnWS:'USD':'JPY');

                          // ************************************************** **
                          // ************************************************** **
                          Monitor;
                          if (xmldoc <> *Null);
                          xmlstr = %str(xmldoc);
                          else;
                          msg = 'Conversion Error';
                          endif

                          I think some problem in the declartion to receive the parameter. can you please help to fix this issue

                          Comment


                          • #14
                            Re: integrated web services server - IWS

                            I cant repost your initial error screen, but look at it again. The error says that 'USD ' is not a valid value for a currency, and its not. It must be 'USD'. The error is likely the C program, which is probably writing a NULL terminated currency code string into the XML.
                            Michael Catalani
                            IS Director, eCommerce & Web Development
                            Acceptance Insurance Corporation
                            www.AcceptanceInsurance.com
                            www.ProvatoSys.com

                            Comment


                            • #15
                              Re: integrated web services server - IWS

                              yes some problem with the C-program, its adding null at the end of To currency, i was using %addr for passing the parameter to C program. Now i changed it by sending directly the parameters as shown and its working fine


                              xmldoc = ConversionRate(CurCnWS:'USD':'JPY');

                              Thanks michael.

                              Comment

                              Working...
                              X