ObjectWeb Consortium
Search ObjectWeb Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | celtix List | June 2006 Index

<--  Date Index     <--  Thread Index    

RE: [celtix] How do I get BindingOperation InputMessage name


Title: Can transport see the operation ?
The WSDL_OPERATION returns null.
 
So what I have done is to use the method name and compared it with a case insensive match with the binding operation name (the method starts with a lower case letter, the binding operation may start with a capital letter).
 
This now works, but I don't think it is perfect.
 
I was assuming that because the getBindingOperation function takes the input and output message names you could overload the operations. If so my code will use the first of the overloaded operations.
 
 

Richard Shaw

¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤

Richard Shaw  
Technical Design Authority - Information Solutions Consultancy  
Intelligent Transport Systems

Atkins Highways and Transportation
Woodcote Grove, Ashley Road, Epsom, Surrey, KT18 5BW

Tel: +44 (0) 1372 756407 
Fax: +44 (0) 1372 740055
Mob: 07740 817586 
E-mail: richard.shaw@xxxxxxxxxxxxxxxx

www.atkinsglobal.com/its

 


From: Paibir, Ajay [mailto:ajay.paibir@xxxxxxxx]
Sent: 21 June 2006 12:00
To: celtix@xxxxxxxxxxxxx
Subject: RE: [celtix] How do I get BindingOperation InputMessage name

Hi Richard,

To my knowledge the bindingOperation name & targetNameSpace combo should be unique and also should map to the operation in the portType.

So if  extensibility elements in a particular bindingoperation are to be retirieved

Then the below code snipet should work.

QName opName = (QName) context.get(MessageContext.WSDL_OPERATION);

//Assuming EndpointReference is available.

Port port = EndpointReferenceUtils.getPort(bus.getWSDLManager(), endpointRef);

Binding binding = port.getBinding();

List<BindingOperation> bol = binding.getBindingOperations();

For (BindingOperation bo : bol) {

If (opName.equals(bo.getName()) {

            //Get The FTP Address Extensibilty Elements

}

Regards

Ajay


From: Shaw, Richard A [mailto:richard.shaw@xxxxxxxxxxxxxxxx]
Sent: 21 June 2006 10:56
To: celtix@xxxxxxxxxxxxx
Subject: [celtix] How do I get BindingOperation InputMessage name

Can I ask this question again, I didn't get an answer and it is the final missing link in my custom transport. I've tried searching the variables in the call stack when debugging the code but I can't find a mention of it (although having said that I can see where the METHOD_OBJ is either but the code gets it).

How do I get the name of the InputMessage and OutputMessage for the bindingOperation that I am using. I need this to pass to the getBindingOperation function.

I was assuming it was METHOD_MESSAGE and METHOD_RETURN but these return null.

My code looks like the following. I will replace obj & obj2 with meaningful names when I work out how to make it work. I can get the input and output message classes from the targetMethod but that is not what getBindingOperation requires.

        Method targetMethod = (Method)context.get(ObjectMessageContext.METHOD_OBJ);
        String methodName = "Unknown";
        if (targetMethod != null)
        {
            methodName = targetMethod.getName();
        }
        Object obj = context.get(ObjectMessageContext.METHOD_MESSAGE);
        Object obj2 = context.get(ObjectMessageContext.METHOD_RETURN);
       
        System.out.println("invoke: " + methodName);

        AddressType address = null;

        Port port;
        try
        {
            port = EndpointReferenceUtils.getPort(bus.getWSDLManager(), endpointRef);
        }
        catch (WSDLException e)
        {
            // TODO Auto-generated catch block
            e.printStackTrace();

            return null;
        }

        // see if the operation has an address defined
        Binding binding = port.getBinding();
        // TODO : fill in the InputMessage and OutputMessage names
        BindingOperation bindingOperation = binding.getBindingOperation(methodName, inputMessageName, outputMessageName);

        @SuppressWarnings("unchecked")
        List<ExtensibilityElement> exts = bindingOperation.getExtensibilityElements();

Richard Shaw

¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤

Richard Shaw  
Technical Design Authority - Information Solutions Consultancy  
Intelligent Transport Systems

Atkins Highways and Transportation
Woodcote Grove, Ashley Road, Epsom, Surrey, KT18 5BW

Tel: +44 (0) 1372 756407 
Fax: +44 (0) 1372 740055
Mob: 07740 817586 
E-mail: richard.shaw@xxxxxxxxxxxxxxxx

www.atkinsglobal.com/its


From: Shaw, Richard A [mailto:richard.shaw@xxxxxxxxxxxxxxxx]
Sent: 20 June 2006 14:34
To: celtix@xxxxxxxxxxxxx
Subject: RE: [celtix] Can transport see the operation ?

I can now get the name of the operation but I can't extract the BindingOperation object because I need the name of the InputMessage and OutputMessage to pass into the getBindingOperation() function along with the method name.

I can't see where these are - I can get the class names but they don't necessarily match the message names. I was assuming that METHOD_MESSAGE and METHOD_RETURN might have been them but they return null.

Richard Shaw

¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤

Richard Shaw  
Technical Design Authority - Information Solutions Consultancy  
Intelligent Transport Systems

Atkins Highways and Transportation
Woodcote Grove, Ashley Road, Epsom, Surrey, KT18 5BW

Tel: +44 (0) 1372 756407 
Fax: +44 (0) 1372 740055
Mob: 07740 817586 
E-mail: richard.shaw@xxxxxxxxxxxxxxxx

www.atkinsglobal.com/its


From: Shaw, Richard A [mailto:richard.shaw@xxxxxxxxxxxxxxxx]
Sent: 20 June 2006 12:37
To: celtix@xxxxxxxxxxxxx
Subject: RE: [celtix] Can transport see the operation ?

Thanks, I was missing the bit that stores the context in my outputMessageContext.

I was extending the GenericMessageContext, I've now changed to extend the MessageContextWrapper and I've added super(context) to my constructor.

Thanks again.

Richard Shaw

¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤

Richard Shaw  
Technical Design Authority - Information Solutions Consultancy  
Intelligent Transport Systems

Atkins Highways and Transportation
Woodcote Grove, Ashley Road, Epsom, Surrey, KT18 5BW

Tel: +44 (0) 1372 756407 
Fax: +44 (0) 1372 740055
Mob: 07740 817586 
E-mail: richard.shaw@xxxxxxxxxxxxxxxx

www.atkinsglobal.com/its


From: Paibir, Ajay [mailto:ajay.paibir@xxxxxxxx]
Sent: 20 June 2006 12:13
To: celtix@xxxxxxxxxxxxx
Subject: RE: [celtix] Can transport see the operation ?

The operation name can be accessed by using the standard JAX-WS MessageContext.WSDL_OPERATION property. Also as per the spec it is not mandatory to set the property in the context.

However on looking through the Celtix Code the Transport context i.e OutputStreamMessageContext should have the property set.  While creating the transport Context using the ServerTransport.createOutputStreamContext(MessageContext bindingContext) the binding context is passed in.

Basically this binding context will have to be wrapped/copied into the output stream context of the FTP transport.

Regards

Ajay


From: Shaw, Richard A [mailto:richard.shaw@xxxxxxxxxxxxxxxx]
Sent: 20 June 2006 11:29
To: celtix@xxxxxxxxxxxxx
Subject: [celtix] Can transport see the operation ?

In my custom transport which gets the response data from an FTP file (the one I posted a couple of weeks ago). I wanted to add extra support so that each operation could be configured in the WSDL to a different file.

My WSDL looks like this -

    <binding name="TrafficNewsISOAPBinding" type="tns:TrafficNewsI">
        <xformat:binding/>
        <operation name="GetTrafficNews">
            <soap:operation soapAction="" style="document"/>
            <input name="GetTrafficNews">
                <soap:body use="literal"/>
            </input>
            <output name="GetTrafficNewsResponse">
                <soap:body use="literal"/>
            </output>
        </operation>
    </binding>
   
    <service name="TrafficNewsService">
        <port binding="tns:TrafficNewsISOAPBinding" name="SOAPOverHTTP">
                <ftpfile:address location="ftp:///myserver/TrafficNews.XML"/>
        </port>
    </service>

So when I make a GetTrafficNews request the reply is the contents of the TrafficNews.xml file on my FTP server.

This is fine when my WSDL defines a single operation, but if there is more than one operation I want to define the following WSDL -

    <binding name="TrafficNewsISOAPBinding" type="tns:TrafficNewsI">
        <xformat:binding/>
        <operation name="GetTrafficNews">
            <soap:operation soapAction="" style="document"/>
                <ftpfile:address location="ftp:///myserver/TrafficNews.XML"/>
            <input name="GetTrafficNews">
                <soap:body use="literal"/>
            </input>
            <output name="GetTrafficNewsResponse">
                <soap:body use="literal"/>
            </output>
        </operation>
        <operation name="GetTrafficSpeeds">
            <soap:operation soapAction="" style="document"/>
                <ftpfile:address location="ftp:///myserver/TrafficSpeeds.XML"/>
            <input name="GetTrafficSpeeds">
                <soap:body use="literal"/>
            </input>
            <output name="GetTrafficSpeedsResponse">
                <soap:body use="literal"/>
            </output>
        </operation>
    </binding>
   
    <service name="TrafficNewsService">
        <port binding="tns:TrafficNewsISOAPBinding" name="SOAPOverHTTP">
                <ftpfile:address location="ftp:///myserver/TrafficNews.XML"/>
        </port>
    </service>

So now if the operation has a file defined it gets the response from there, otherwise it uses the file defined in the port. GetTrafficNews reads from TrafficNews.xml and GetTrafficSpeeds reads from TrafficSpeeds.xml

My question is (finally) how can my transport work out what the operation is so that it can get the correct filename ? I want this to work with any binding (I've tested pure XML and SOAP), looking at the source code of Celtix it seems that transport doesn't have access to the binding context so it can't use it to query what the operation was.

I did wonder if I should have used a handler instead because it has access to the LogicalMessageContext and can work out what the operation is and then get the response from the FTP server, but this isn't quite as neat, and is harder to configure for use.

Richard Shaw

¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤

Richard Shaw  
Technical Design Authority - Information Solutions Consultancy  
Intelligent Transport Systems

Atkins Highways and Transportation
Woodcote Grove, Ashley Road, Epsom, Surrey, KT18 5BW

Tel: +44 (0) 1372 756407 
Fax: +44 (0) 1372 740055
Mob: 07740 817586 
E-mail: richard.shaw@xxxxxxxxxxxxxxxx

www.atkinsglobal.com/its

This email and any attached files are confidential and copyright protected. If you are not the addressee, any dissemination of this communication is strictly prohibited. Unless otherwise expressly agreed in writing, nothing stated in this communication shall be legally binding.

This message has been scanned for viruses by MailControl



<--  Date Index     <--  Thread Index    

Reply via email to:

Powered by MHonArc.

Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.