0

My company has subscribed to a service offered by a travel reservation system whereby they call us back when any changes occur to a travel itinerary. My task is to stand up a SOAP endpoint to accept this callback. I am doing this with standard jax-ws stuff.

Here is the essentials of their soap message:

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" xmlns:swse="http://wse.sabre.com/eventing"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing">
<soap-env:Header>
    <eb:MessageHeader eb:version="1.0"
        soap-env:mustUnderstand="1">
        <wse:MySubscription>7TZA</wse:MySubscription>
        <swse:EventTopic>WSE.QUEUE.CCC.PNRCHNG</swse:EventTopic>
    </eb:MessageHeader>
    <wsa:Action>http://wse.sabre.com/EventSource/notification</wsa:Action>
    <wsa:MessageID>721d8dc0-1307-4b27-a48b-a9ba7f7818c7</wsa:MessageID>
    <wse:Identifer>7f9aad13-a8cd-4057-8c91-89ccfad64598</wse:Identifer>
    <wsa:To>http://localhost:18888/</wsa:To>
</soap-env:Header>
<soap-env:Body>
    <swse:CCC.PNRCHNG>
        <swse:OWNPCC>N0V3</swse:OWNPCC>
        <swse:HOMEPCC>W0H3</swse:HOMEPCC>
        <swse:Locator>IGLYIZ</swse:Locator>
        <swse:EventTimeStamp format="yyyy-MM-dd hh:mm:ss.fffffffff">2007-10-30 11:41:32.000986</swse:EventTimeStamp>
        <swse:ChangeIndicators>
            <swse:Indicator name="Ticketing">
                <swse:hasChanged>Y</swse:hasChanged>
            </swse:Indicator>
            ...
    </swse:CCC.PNRCHNG>
</soap-env:Body>

I have a functioning SOAPHandler with a getHeaders() implementation wich is satisfying the mustUnderstand=1 requirement.

I have a @WebMethod that is successfully accepting a few of the top level parts of the payload. This is actually good enough for now, but I would like to understand how to write a @Webmethod that would accept the whole payload as a complex object.

I have a jibx-generated CCC.PNRCHNG class. But how would I write the @WebMethod to accept it? Below is the method that accepts the top level bits as separate @WebParams (Locator is all I really need right now)

    @WebMethod(operationName="CCC.PNRCHNG", action="http://wse.sabre.com/EventSource/notification")
public Object onPnrEvent(
        @WebParam(name="OWNPCC", targetNamespace=NS) String ownPcc,
        @WebParam(name="HOMEPCC", targetNamespace=NS) String homePcc,
        @WebParam(name="Locator", targetNamespace=NS) String locator
        ) {
    try {
        s_logger.info(locator);
    }
    catch(Exception e) {
        s_logger.error(e);
    }
    return null;
}

It would be nice to get the full model so any advice there would be very much appreciated.

Bob D
  • 1
  • 2
  • Do you have a WSDL for this callback interface? If so you can use `wsimport` to generate a service provider, including a `@WebMethod` that accepts the full complex type object model input param(s). – Scott Heaberlin Mar 29 '16 at 01:33

1 Answers1

0

Best way would be to generate PortType based on WSDL with wsimport. If you don't have a WSDL, I wouldn't bother with writing a wrapped JAX-WS service.

On your class, add this annotation

@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)

Then write methods that accept the root element. Something like this:

@WebMethod(operationName="CCC.PNRCHNG", action="http://wse.sabre.com/EventSource/notification")
public Object onPnrEvent( @WebParam(name="CCC.PNRCHNG", targetNamespace=NS) PNRCHNG request) {

}