IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

JAVA Logger service

  • 1.  JAVA Logger service

    Posted Thu February 04, 2016 05:21 AM

    Hi guys
    I have a service (virtualized service created from WSDL means no provider/ consumer descriptor)
    Calling this service,the additional JAVA logger service has to be called too to log the http status code.
    I could not get the status parameter from MessageContext . Can you give me a hint please.
    Thanks
    Peter


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 2.  RE: JAVA Logger service

    Posted Thu February 04, 2016 09:22 AM

    Peter-- What all services did you use ? If possible any snapshots of your flow if possible ?

    Thanks,


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 3.  RE: JAVA Logger service

    Posted Thu February 04, 2016 09:49 AM

    Hi
    1)I have virtualized a WSDL. The service routes (Routing Protocols) the request as usual to a service which sends data back to caller if was successfull call, if not, nothing commes back.
    2) I created a JAVA service(CheckCode.java) that should analyze the MessageContext for http response code (200 Ok, etc ).
    Ths service is called from the virtual Service:
    CS-> Response processing step → add Step → "webMethods IS Service"
    (added UtilPackage.Util:CheckCode service )
    When I trigger the VS service, I can call this JAVA and I get the MessageContext too. but there are everything else than the status code.
    It seems in the MessageContext the status code is not available. Ok, but how do I access this status code inside my above object (CheckCode.java)

    2.Option
    If it is not possible to get the parameter at all, is there any other Server environment parameter indicates the status of service call too?

    I hope it is more clear

    Thanks
    Peter


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 4.  RE: JAVA Logger service

    Posted Thu February 04, 2016 10:02 AM

    Peter, I understood your need but I am not quite sure why status code is not exist in your response. I could not comment on this untill I can see your code,is it possible to give snapshot of your code to suggest you further.

    Thanks,


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 5.  RE: JAVA Logger service

    Posted Thu February 04, 2016 10:20 AM

    Here is my JAVA code snipt which displays all data from the MessageContex:

    public static final void inspectMessageContext (IData pipeline)
    throws ServiceException
    {
    // — <<IS-START(inspectMessageContext)>> —
    // @sigtype java 3.5
    IDataCursor cursor = pipeline.getCursor();
    cursor.first();

    	//Get the Message Context Object
    if(cursor.first(&quot;MessageContext&quot;)){
    Object obj = cursor.getValue();
    if(obj instanceof MessageContext){
    MessageContext msgContext = (MessageContext)obj;
    //Get the properties and iterate
    System.out.println(&quot;Inspecting the Message Context Properties>>>>>&quot;);
    for (Iterator iterator = msgContext.getPropertyNames(); iterator
    .hasNext();) {
    String prop = (String) iterator.next();
    System.out.println(&quot;Property:&quot; + prop + &quot; Value:&quot; + msgContext.getProperty(prop));
    }
    }
    }
    
    // --- <<IS-END>> ---
    
    
    }
    

    }


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 6.  RE: JAVA Logger service

    Posted Thu February 04, 2016 10:25 AM

    Peter – Code is looking okay to me. Are you sure that ‘status code’ is coming as part of MessageContext. Can you please cross check your webService ?

    Thanks,


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 7.  RE: JAVA Logger service

    Posted Thu February 04, 2016 10:30 AM

    check your web service
    There is no Web service code! the only code is the JAVA code I sent you. The web service is only a virtualization, a proxy created from WSDL in CS.
    In meanwhile I think the messageContext is not the right place to search for this code!
    This is exactlly my question, how to get the code in my scenario! It seems form MessagesContext, not possible, but from what or how ?


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 8.  RE: JAVA Logger service

    Posted Thu February 04, 2016 11:27 AM


    INFO | jvm 1 | 2016/02/04 15:14:03 | Property:HTTP_METHOD Value:POST
    INFO | jvm 1 | 2016/02/04 15:14:03 | Property:CREDENTIALS_PASSED Value:true
    INFO | jvm 1 | 2016/02/04 15:14:03 | Property:use Value:literal
    INFO | jvm 1 | 2016/02/04 15:14:03 | Property:OutTransportInfo Value:com.wm.app.b2b.server.wss.AxisHttpResponseAdapter@6fc68474
    INFO | jvm 1 | 2016/02/04 15:14:03 | Property:HTTP_RESPONSE_CODE_CALLBACK Value:com.softwareag.pg.axis2.transports.ISHTTPResponseCodeCallback@ea566f2

    Above in output found this data:
    Property:HTTP_RESPONSE_CODE_CALLBACK Value:com.softwareag.pg.axis2.transports.ISHTTPResponseCodeCallback@ea566f2
    ??


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 9.  RE: JAVA Logger service

    Posted Thu February 04, 2016 03:09 PM

    Have you tried calling that webservice from soap client?
    Whether you are getting any output while ruunnig the java service which you have created?
    Please share the WSDL file just to verify/check if there is any tags are missing.


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 10.  RE: JAVA Logger service

    Posted Fri February 05, 2016 04:01 AM

    Hi
    Seee my prvious messages (the output, the JAVA code) the WSDL is valid and simple
    But which soapClient you mean and what does help if I call it in “soapclient” or not? I already said I call successfully and I get valid output(but not that stauts parameter)
    Regads


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 11.  RE: JAVA Logger service

    Posted Sat February 06, 2016 08:23 AM

    Peter, if statusCode variable exist as part of MessageContext object then you should definitely get. Are you getting NULL or empty value ?

    Thanks,


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services