You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "M.Ismail" <mo...@gmail.com> on 2010/08/17 17:55:14 UTC

CXF CORBA binding problem

Hi, 

I'm using camel 2.3 to communicate with a CORBA server. I have generated a
WSDL from the IDLs and then the java stubs from the WSDL and I ran the
generated client without a problem. The client simply attempt to create a
session from and after receiving a session object it uses it to invoke some
operations. Here is the CXF code: 

           ECITECITSessionCORBAService ecitSessionService = new
ECITECITSessionCORBAService(wsdlURL, ECIT_SERVICE_NAME);
        ECITECITSession ecitSession =
ecitSessionService.getECITECITSessionCORBAPort();  

            java.lang.String _createSession_aInterface = "intf1";
            java.lang.String _createSession_aUsername = "user1";
            java.lang.String _createSession_aPassword = "password";
            try {
                javax.xml.ws.wsaddressing.W3CEndpointReference
_createSession__return = null;
               
               _createSession__return = ecitSession.createSession("ECIT", 
            		   										_createSession_aUsername,
_createSession_aPassword);
               
               ECITECITSession ecitSessionRet =
ecitSessionService.getPort(_createSession__return,ECITECITSession.class);
               System.out.println("Result: "+_createSession__return);
               
               javax.xml.ws.wsaddressing.W3CEndpointReference epr =
            	   ecitSessionRet.newTransaction("774", 150L, "524", "015");            
               
               ECIECITransactionController transController = 
				
eciTransControllerService.getPort(epr,ECIECITransactionController.class);

and Here is how I tried to port this code to camel:

String cxfSessionFactory = "cxf://corbaname::"+confBean.getEmIP()+":"+
confBean.getEmPort()+ "#ECISessionFactory?"+
									"serviceClass="+ cxf.ECITECITSession.class.getName()+									
									"&dataFormat=POJO"+
									"&portName={http://www.its.ws}ECIT.ECITSessionCORBAPort"+
									"&serviceName={http://www.its.ws}ECIT.ECITSessionCORBAService"+
									"&wsdlURL="+confBean.getEmWSDL();
    	
    	String cxfNewTransaction = "cxf://corbaname::"+confBean.getEmIP()+":"+
confBean.getEmPort()+ "#ECISessionFactory?"+
		"serviceClass="+ cxf.ECITECITSession.class.getName()+									
		"&dataFormat=POJO"+
		"&portName={http://www.its.ws}ECIT.ECITSessionCORBAPort"+
		"&serviceName={http://www.its.ws}ECIT.ECITSessionCORBAService"+
		"&wsdlURL="+confBean.getEmWSDL();
    	
    	
    	    	
    	from("direct:processEmRequests")
    	.routeId("Em sub route")
    	.unmarshal(jaxbUrrFinalApi)
    	
    	.choice()
    	.when(bean("EmLoginBean","isLoggedIn").isNotEqualTo(constant(true)))
    	
    		.doTry()
    			.process(new EmLoginProcessor())
    			.to(cxfSessionFactory)    
    			.process(new UrrXmlReqToEmProcessor())
    			.to(cxfNewTransaction )
    			.to("direct:processEmResp")
    		.doCatch(ECIEPermissionDenied.class,ECIESystemDown.class)
    		.process(new ExceptionProcessorHandler())
    		.end()

    	.end();

As you notice I'm using the "cxf://corbaname?" to refer to the name of the
CORBA object that I want to get a reference of e.g when creating a session I
use "ECISessionFactory". In both the cxf and Camel I'm able to invoke
createSession operation and get the return value successfully. However, the
problem here is that in camel after I get the session and try to invoke
newTransaction I get the following CORBA exception:

org.omg.CORBA.BAD_OPERATION:   vmcid: 0x45520000  minor code: 4  completed:
No

I used WireShark to sniff the GIOP packet try to know the reason and I found
that in Camel's case instead of calling the operation "newTransaction"
directly, a call to "_is_a" then a call to "resolve_str" then finally a call
to "newTransaction" which fails giving the above CORBA exception. I'm not
sure what is the problem here. Can anyone help?

Thanks,


-- 
View this message in context: http://camel.465427.n5.nabble.com/CXF-CORBA-binding-problem-tp2638356p2638356.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CXF CORBA binding problem

Posted by "M.Ismail" <mo...@gmail.com>.
Hi,

Actually I tried that too. In fact I have added other CXFConstants too to
the Out header here is the ProcessNewTransaction() process:

public void process(Exchange exchange) throws Exception {
        ECITECITSessionCORBAService ecitService = new
ECITECITSessionCORBAService ();

        // Get the EPR object from the in body
        MessageContentsList msgList =
(MessageContentsList)exchange.getIn().getBody();
        javax.xml.ws.wsaddressing.W3CEndpointReference epr
                            = (W3CEndpointReference)msgList.get(0);
        // Get the Session object (ECITECITSession ) from the EPR
        ECITECITSession ecitSession = ecitService.getPort(epr,
ECITECITSession.class);

        if(ecitSession.getUserDailyLimit()<=0)
            throw new IllegalArgumentException("Insifficient funds");


        ConfigurationBean confBean = exchange.getContext().getRegistry()
                        .lookup("Configuration",ConfigurationBean.class);

        // Set the required CXFConstants
        String service = "ECIT.ECITSessionCORBAService";
        String port = "ECIT.ECITSessionCORBAPort";
        String serviceClass = ECITECITSession.class.getName();
        String intfcShortname = null;

        msgList = new MessageContentsList();

        String operation = "newTransaction";

        // Add the following test parameters for newTransaction operation
        msgList.add("774");
        msgList.add(150L);
        msgList.add(524);
        msgList.add("015");

        exchange.getOut().setBody(msgList);

        exchange.getOut().setHeader(CxfConstants.OPERATION_NAME, operation);
        exchange.getIn().setHeader(CxfConstants.OPERATION_NAMESPACE, "
http://www.its.ws");

        exchange.getOut().setHeader(CxfConstants.METHOD, operation);

        exchange.getOut().setHeader(CxfConstants.SERVICE_NAME, service);
        exchange.getOut().setHeader(CxfConstants.SERVICE_NAMESPACE, "
http://www.its.ws");

        exchange.getOut().setHeader(CxfConstants.PORT_NAME, port);
        exchange.getOut().setHeader(CxfConstants.PORT_NAMESPACE, "
http://www.its.ws");

        exchange.getOut().setHeader(CxfConstants.SERVICE_CLASS,
serviceClass);
        exchange.getOut().setHeader(CxfConstants.WSDL_URL,
confBean.getEmWSDL());

    }


Thanks,


On Thu, Aug 19, 2010 at 3:06 AM, Willem.Jiang [via Camel] <
ml-node+2640360-2075804343-45138@n5.nabble.com<ml...@n5.nabble.com>
> wrote:

> As the camel-cxf producer using the message header Operation name to let
> the CXF client which method it should call.
> I think you need to specify the operation name in the process(new
> ProcessNewTransaction()) or you can use setHeader() dsl to do it.
>
> You can find more information about the CXF operation here[1]
>
> [1]
> http://camel.apache.org/cxf.html#CXF-HowtopreparethemessageforthecamelcxfendpointinPOJOdataformat
>
> Willem
>
>
> M.Ismail wrote:
>
> > Hi,
> >
> > Using the normal CXF generated client I can invoke the CORBA service with
> no
> > problem. I even use the same technique to invoke multiple operations of
> the
> > CORBA service but in a single processor
> >
> > For example I can get the return of a previous invocation as a EPR and
> use
> > it to invoke other methods in a single processor:
> >
> > public void process(Exchange exchange){
> > MessageContentsList msgList =
> > (MessageContentsList)exchange.getIn().getBody();
> >
> > try{
> >         javax.xml.ws.wsaddressing.W3CEndpointReference epr
> >                                             =
> > (W3CEndpointReference)msgList.get(0);
> >
> >        ECITECITSessionCORBAService ecitService = new
> > ECITECITSessionCORBAService ();
> >        ECITECITSession ecitSession = ecitService.getPort(epr,
> > ECITECITSession.class);
> >
> >
> >
> >        javax.xml.ws.wsaddressing.W3CEndpointReference epr =
> >                ecitSessionRet.newTransaction("774", 150L, "524", "015");
> >
> >
> >        ECIECITransactionController transController =
> >
> > eciTransControllerService.getPort(epr,ECIECITransactionController.class);
>
> >
> >        ECIStatisticsCORBAService ecisService = new
> > ECIStatisticsCORBAService();
> >
> >
> >        if(transController.getState().equals("SUCCESS"))
> >        {
> >            epr = transController.getStatisticalInformation();
> >            ECIStatistics stats =
> > ecisService.getPort(epr,ECIStatistics.class);
> >
> >            exchange.getOut.setBody(stats);
> >
> >
> >        }
> > catch(......)
> >
> > finally(.....)
> >
> >        ............
> >        .......
> >
> > }
> >
> > However, this solution doesn't provide the flexibility expected from
> camel.
> > The better solution would be something like this:
> >
> > .choice()
> >
> .when(bean("EmLoginBean","isLoggedIn").isNotEqualTo(constant(true)))
> >
> >             .doTry()
> >                 .process(new EmLoginProcessor())    // Try to get a
> "Session
> > object"
> >                 .to(cxfSessionFactory)     // Invoked createSession
> >                 .process(new ProcessNewTransaction())     // Got the
> > sessionObject and try to call sessionObject.newTransaction()
> >                 .to(cxfSessionFactory)   //  Here I get
> > "CORBA.BAD_OPERATION" exception
> >                 .process(new TransactionResp())
> >                 .choice().when().simple("${in.body.state} == 'FAILED')
> >                             .to("activemq:FailedTransactions")
> >                .end()
> >                 .process(new StatisticsReq())
> >                 .to(cxfSessionFactory)
> >                 .process(new StatisticsResp());
> >                 .choice().when().simple("${in.body.state} == 'FAILED')
> >                             .to("activemq:FailedStatistics")
> >                .end()
> >            .doCatch(InvalidLoginCredentials.class)
> >             ............
> >             ........
> >
> >
> > When I try such a solution it fails giving me this CORBA error:
> >      org.omg.CORBA.BAD_OPERATION:   vmcid: 0x45520000  minor code: 4
> >  completed: No
> >
> > I think this is due to a problem with associating the response object
> from a
> > previous call with the next operation invocation. What do you think?
> >
> > Thanks,
> >
> >
> >
> >
> > On Wed, Aug 18, 2010 at 12:27 PM, Willem.Jiang [via Camel] <
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=2640360&i=0><[hidden
> email] <http://user/SendEmail.jtp?type=node&node=2640360&i=1>>
> >> wrote:
> >
> >> Can you try to use CXF to invoke the CORBA service first?
> >> I'm not sure the CXF can talk the CORBA server rightly.
> >>
> >> Willem
> >>
> >> M.Ismail wrote:
> >>
> >>> Hi,
> >>>
> >>> I'm using camel 2.3 to communicate with a CORBA server. I have
> generated
> >> a
> >>> WSDL from the IDLs and then the java stubs from the WSDL and I ran the
> >>> generated client without a problem. The client simply attempt to create
> a
> >>> session from and after receiving a session object it uses it to invoke
> >> some
> >>> operations. Here is the CXF code:
> >>>
> >>>            ECITECITSessionCORBAService ecitSessionService = new
> >>> ECITECITSessionCORBAService(wsdlURL, ECIT_SERVICE_NAME);
> >>>         ECITECITSession ecitSession =
> >>> ecitSessionService.getECITECITSessionCORBAPort();
> >>>
> >>>             java.lang.String _createSession_aInterface = "intf1";
> >>>             java.lang.String _createSession_aUsername = "user1";
> >>>             java.lang.String _createSession_aPassword = "password";
> >>>             try {
> >>>                 javax.xml.ws.wsaddressing.W3CEndpointReference
> >>> _createSession__return = null;
> >>>
> >>>                _createSession__return =
> ecitSession.createSession("ECIT",
> >>>               _createSession_aUsername,
> >>> _createSession_aPassword);
> >>>
> >>>                ECITECITSession ecitSessionRet =
> >>>
> ecitSessionService.getPort(_createSession__return,ECITECITSession.class);
> >>>                System.out.println("Result: "+_createSession__return);
> >>>
> >>>                javax.xml.ws.wsaddressing.W3CEndpointReference epr =
> >>>               ecitSessionRet.newTransaction("774", 150L, "524", "015");
>
> >>>                ECIECITransactionController transController =
> >>>
> >>>
> eciTransControllerService.getPort(epr,ECIECITransactionController.class);
> >>> and Here is how I tried to port this code to camel:
> >>>
> >>> String cxfSessionFactory = "cxf://corbaname::"+confBean.getEmIP()+":"+
> >>> confBean.getEmPort()+ "#ECISessionFactory?"+
> >>> "serviceClass="+ cxf.ECITECITSession.class.getName()+
> >>> "&dataFormat=POJO"+
> >>> "&portName={http://www.its.ws <http://www.its.ws?by-user=t> <
> http://www.its.ws?by-user=t <http://www.its.ws?by-user=t&by-user=t>>}ECIT.ECITSessionCORBAPort"+
>
> >>> "&serviceName={http://www.its.ws <http://www.its.ws?by-user=t> <
> http://www.its.ws?by-user=t <http://www.its.ws?by-user=t&by-user=t>>}ECIT.ECITSessionCORBAService"+
>
> >>> "&wsdlURL="+confBean.getEmWSDL();
> >>>
> >>>     String cxfNewTransaction =
> >> "cxf://corbaname::"+confBean.getEmIP()+":"+
> >>> confBean.getEmPort()+ "#ECISessionFactory?"+
> >>> "serviceClass="+ cxf.ECITECITSession.class.getName()+
> >>> "&dataFormat=POJO"+
> >>> "&portName={http://www.its.ws <http://www.its.ws?by-user=t> <
> http://www.its.ws?by-user=t <http://www.its.ws?by-user=t&by-user=t>>}ECIT.ECITSessionCORBAPort"+
>
> >>> "&serviceName={http://www.its.ws <http://www.its.ws?by-user=t> <
> http://www.its.ws?by-user=t <http://www.its.ws?by-user=t&by-user=t>>}ECIT.ECITSessionCORBAService"+
>
> >>> "&wsdlURL="+confBean.getEmWSDL();
> >>>
> >>>
> >>>
> >>>     from("direct:processEmRequests")
> >>>     .routeId("Em sub route")
> >>>     .unmarshal(jaxbUrrFinalApi)
> >>>
> >>>     .choice()
> >>>
> .when(bean("EmLoginBean","isLoggedIn").isNotEqualTo(constant(true)))
> >>>
> >>>     .doTry()
> >>>     .process(new EmLoginProcessor())
> >>>     .to(cxfSessionFactory)
> >>>     .process(new UrrXmlReqToEmProcessor())
> >>>     .to(cxfNewTransaction )
> >>>     .to("direct:processEmResp")
> >>>     .doCatch(ECIEPermissionDenied.class,ECIESystemDown.class)
> >>>     .process(new ExceptionProcessorHandler())
> >>>     .end()
> >>>
> >>>     .end();
> >>>
> >>> As you notice I'm using the "cxf://corbaname?" to refer to the name of
> >> the
> >>> CORBA object that I want to get a reference of e.g when creating a
> >> session I
> >>> use "ECISessionFactory". In both the cxf and Camel I'm able to invoke
> >>> createSession operation and get the return value successfully. However,
>
> >> the
> >>> problem here is that in camel after I get the session and try to invoke
>
> >>> newTransaction I get the following CORBA exception:
> >>>
> >>> org.omg.CORBA.BAD_OPERATION:   vmcid: 0x45520000  minor code: 4
> >>  completed:
> >>> No
> >>>
> >>> I used WireShark to sniff the GIOP packet try to know the reason and I
> >> found
> >>> that in Camel's case instead of calling the operation "newTransaction"
> >>> directly, a call to "_is_a" then a call to "resolve_str" then finally a
>
> >> call
> >>> to "newTransaction" which fails giving the above CORBA exception. I'm
> not
> >>> sure what is the problem here. Can anyone help?
> >>>
> >>> Thanks,
> >>>
> >>>
> >>
> >>
> >> ------------------------------
> >>  View message @
> >>
> http://camel.465427.n5.nabble.com/CXF-CORBA-binding-problem-tp2638356p2639222.html<http://camel.465427.n5.nabble.com/CXF-CORBA-binding-problem-tp2638356p2639222.html?by-user=t>
> >> To start a new topic under Camel - Users, email
> >> [hidden email] <http://user/SendEmail.jtp?type=node&node=2640360&i=2><[hidden
> email] <http://user/SendEmail.jtp?type=node&node=2640360&i=3>>
> >> To unsubscribe from Camel - Users, click here<
> http://camel.465427.n5.nabble.com/template/NodeServlet.jtp?tpl=unsubscribe_by_code&node=465428&code=bW9oYW1tZWQuaGFueUBnbWFpbC5jb218NDY1NDI4fDIwNzI5Nzg2NDM=<http://camel.465427.n5.nabble.com/template/NodeServlet.jtp?tpl=unsubscribe_by_code&node=465428&code=bW9oYW1tZWQuaGFueUBnbWFpbC5jb218NDY1NDI4fDIwNzI5Nzg2NDM=&by-user=t>>.
>
> >>
> >>
> >>
> >
>
>
>
> ------------------------------
>  View message @
> http://camel.465427.n5.nabble.com/CXF-CORBA-binding-problem-tp2638356p2640360.html
> To start a new topic under Camel - Users, email
> ml-node+465428-424999138-45138@n5.nabble.com<ml...@n5.nabble.com>
> To unsubscribe from Camel - Users, click here<http://camel.465427.n5.nabble.com/template/NodeServlet.jtp?tpl=unsubscribe_by_code&node=465428&code=bW9oYW1tZWQuaGFueUBnbWFpbC5jb218NDY1NDI4fDIwNzI5Nzg2NDM=>.
>
>
>

-- 
View this message in context: http://camel.465427.n5.nabble.com/CXF-CORBA-binding-problem-tp2638356p2640876.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CXF CORBA binding problem

Posted by Willem Jiang <wi...@gmail.com>.
As the camel-cxf producer using the message header Operation name to let 
the CXF client which method it should call.
I think you need to specify the operation name in the process(new 
ProcessNewTransaction()) or you can use setHeader() dsl to do it.

You can find more information about the CXF operation here[1]

[1]http://camel.apache.org/cxf.html#CXF-HowtopreparethemessageforthecamelcxfendpointinPOJOdataformat

Willem


M.Ismail wrote:
> Hi,
> 
> Using the normal CXF generated client I can invoke the CORBA service with no
> problem. I even use the same technique to invoke multiple operations of the
> CORBA service but in a single processor
> 
> For example I can get the return of a previous invocation as a EPR and use
> it to invoke other methods in a single processor:
> 
> public void process(Exchange exchange){
> MessageContentsList msgList =
> (MessageContentsList)exchange.getIn().getBody();
> 
> try{
>         javax.xml.ws.wsaddressing.W3CEndpointReference epr
>                                             =
> (W3CEndpointReference)msgList.get(0);
> 
>        ECITECITSessionCORBAService ecitService = new
> ECITECITSessionCORBAService ();
>        ECITECITSession ecitSession = ecitService.getPort(epr,
> ECITECITSession.class);
> 
> 
> 
>        javax.xml.ws.wsaddressing.W3CEndpointReference epr =
>                ecitSessionRet.newTransaction("774", 150L, "524", "015");
> 
> 
>        ECIECITransactionController transController =
> 
> eciTransControllerService.getPort(epr,ECIECITransactionController.class);
> 
>        ECIStatisticsCORBAService ecisService = new
> ECIStatisticsCORBAService();
> 
> 
>        if(transController.getState().equals("SUCCESS"))
>        {
>            epr = transController.getStatisticalInformation();
>            ECIStatistics stats =
> ecisService.getPort(epr,ECIStatistics.class);
> 
>            exchange.getOut.setBody(stats);
> 
> 
>        }
> catch(......)
> 
> finally(.....)
> 
>        ............
>        .......
> 
> }
> 
> However, this solution doesn't provide the flexibility expected from camel.
> The better solution would be something like this:
> 
> .choice()
>         .when(bean("EmLoginBean","isLoggedIn").isNotEqualTo(constant(true)))
> 
>             .doTry()
>                 .process(new EmLoginProcessor())    // Try to get a "Session
> object"
>                 .to(cxfSessionFactory)     // Invoked createSession
>                 .process(new ProcessNewTransaction())     // Got the
> sessionObject and try to call sessionObject.newTransaction()
>                 .to(cxfSessionFactory)   //  Here I get
> "CORBA.BAD_OPERATION" exception
>                 .process(new TransactionResp())
>                 .choice().when().simple("${in.body.state} == 'FAILED')
>                             .to("activemq:FailedTransactions")
>                .end()
>                 .process(new StatisticsReq())
>                 .to(cxfSessionFactory)
>                 .process(new StatisticsResp());
>                 .choice().when().simple("${in.body.state} == 'FAILED')
>                             .to("activemq:FailedStatistics")
>                .end()
>            .doCatch(InvalidLoginCredentials.class)
>             ............
>             ........
> 
> 
> When I try such a solution it fails giving me this CORBA error:
>      org.omg.CORBA.BAD_OPERATION:   vmcid: 0x45520000  minor code: 4
>  completed: No
> 
> I think this is due to a problem with associating the response object from a
> previous call with the next operation invocation. What do you think?
> 
> Thanks,
> 
> 
> 
> 
> On Wed, Aug 18, 2010 at 12:27 PM, Willem.Jiang [via Camel] <
> ml-node+2639222-1625143626-45138@n5.nabble.com<ml...@n5.nabble.com>
>> wrote:
> 
>> Can you try to use CXF to invoke the CORBA service first?
>> I'm not sure the CXF can talk the CORBA server rightly.
>>
>> Willem
>>
>> M.Ismail wrote:
>>
>>> Hi,
>>>
>>> I'm using camel 2.3 to communicate with a CORBA server. I have generated
>> a
>>> WSDL from the IDLs and then the java stubs from the WSDL and I ran the
>>> generated client without a problem. The client simply attempt to create a
>>> session from and after receiving a session object it uses it to invoke
>> some
>>> operations. Here is the CXF code:
>>>
>>>            ECITECITSessionCORBAService ecitSessionService = new
>>> ECITECITSessionCORBAService(wsdlURL, ECIT_SERVICE_NAME);
>>>         ECITECITSession ecitSession =
>>> ecitSessionService.getECITECITSessionCORBAPort();
>>>
>>>             java.lang.String _createSession_aInterface = "intf1";
>>>             java.lang.String _createSession_aUsername = "user1";
>>>             java.lang.String _createSession_aPassword = "password";
>>>             try {
>>>                 javax.xml.ws.wsaddressing.W3CEndpointReference
>>> _createSession__return = null;
>>>
>>>                _createSession__return = ecitSession.createSession("ECIT",
>>>               _createSession_aUsername,
>>> _createSession_aPassword);
>>>
>>>                ECITECITSession ecitSessionRet =
>>> ecitSessionService.getPort(_createSession__return,ECITECITSession.class);
>>>                System.out.println("Result: "+_createSession__return);
>>>
>>>                javax.xml.ws.wsaddressing.W3CEndpointReference epr =
>>>               ecitSessionRet.newTransaction("774", 150L, "524", "015");
>>>                ECIECITransactionController transController =
>>>
>>> eciTransControllerService.getPort(epr,ECIECITransactionController.class);
>>> and Here is how I tried to port this code to camel:
>>>
>>> String cxfSessionFactory = "cxf://corbaname::"+confBean.getEmIP()+":"+
>>> confBean.getEmPort()+ "#ECISessionFactory?"+
>>> "serviceClass="+ cxf.ECITECITSession.class.getName()+
>>> "&dataFormat=POJO"+
>>> "&portName={http://www.its.ws <http://www.its.ws?by-user=t>}ECIT.ECITSessionCORBAPort"+
>>> "&serviceName={http://www.its.ws <http://www.its.ws?by-user=t>}ECIT.ECITSessionCORBAService"+
>>> "&wsdlURL="+confBean.getEmWSDL();
>>>
>>>     String cxfNewTransaction =
>> "cxf://corbaname::"+confBean.getEmIP()+":"+
>>> confBean.getEmPort()+ "#ECISessionFactory?"+
>>> "serviceClass="+ cxf.ECITECITSession.class.getName()+
>>> "&dataFormat=POJO"+
>>> "&portName={http://www.its.ws <http://www.its.ws?by-user=t>}ECIT.ECITSessionCORBAPort"+
>>> "&serviceName={http://www.its.ws <http://www.its.ws?by-user=t>}ECIT.ECITSessionCORBAService"+
>>> "&wsdlURL="+confBean.getEmWSDL();
>>>
>>>
>>>
>>>     from("direct:processEmRequests")
>>>     .routeId("Em sub route")
>>>     .unmarshal(jaxbUrrFinalApi)
>>>
>>>     .choice()
>>>     .when(bean("EmLoginBean","isLoggedIn").isNotEqualTo(constant(true)))
>>>
>>>     .doTry()
>>>     .process(new EmLoginProcessor())
>>>     .to(cxfSessionFactory)
>>>     .process(new UrrXmlReqToEmProcessor())
>>>     .to(cxfNewTransaction )
>>>     .to("direct:processEmResp")
>>>     .doCatch(ECIEPermissionDenied.class,ECIESystemDown.class)
>>>     .process(new ExceptionProcessorHandler())
>>>     .end()
>>>
>>>     .end();
>>>
>>> As you notice I'm using the "cxf://corbaname?" to refer to the name of
>> the
>>> CORBA object that I want to get a reference of e.g when creating a
>> session I
>>> use "ECISessionFactory". In both the cxf and Camel I'm able to invoke
>>> createSession operation and get the return value successfully. However,
>> the
>>> problem here is that in camel after I get the session and try to invoke
>>> newTransaction I get the following CORBA exception:
>>>
>>> org.omg.CORBA.BAD_OPERATION:   vmcid: 0x45520000  minor code: 4
>>  completed:
>>> No
>>>
>>> I used WireShark to sniff the GIOP packet try to know the reason and I
>> found
>>> that in Camel's case instead of calling the operation "newTransaction"
>>> directly, a call to "_is_a" then a call to "resolve_str" then finally a
>> call
>>> to "newTransaction" which fails giving the above CORBA exception. I'm not
>>> sure what is the problem here. Can anyone help?
>>>
>>> Thanks,
>>>
>>>
>>
>>
>> ------------------------------
>>  View message @
>> http://camel.465427.n5.nabble.com/CXF-CORBA-binding-problem-tp2638356p2639222.html
>> To start a new topic under Camel - Users, email
>> ml-node+465428-424999138-45138@n5.nabble.com<ml...@n5.nabble.com>
>> To unsubscribe from Camel - Users, click here<http://camel.465427.n5.nabble.com/template/NodeServlet.jtp?tpl=unsubscribe_by_code&node=465428&code=bW9oYW1tZWQuaGFueUBnbWFpbC5jb218NDY1NDI4fDIwNzI5Nzg2NDM=>.
>>
>>
>>
> 


Re: CXF CORBA binding problem

Posted by "M.Ismail" <mo...@gmail.com>.
Hi,

Using the normal CXF generated client I can invoke the CORBA service with no
problem. I even use the same technique to invoke multiple operations of the
CORBA service but in a single processor

For example I can get the return of a previous invocation as a EPR and use
it to invoke other methods in a single processor:

public void process(Exchange exchange){
MessageContentsList msgList =
(MessageContentsList)exchange.getIn().getBody();

try{
        javax.xml.ws.wsaddressing.W3CEndpointReference epr
                                            =
(W3CEndpointReference)msgList.get(0);

       ECITECITSessionCORBAService ecitService = new
ECITECITSessionCORBAService ();
       ECITECITSession ecitSession = ecitService.getPort(epr,
ECITECITSession.class);



       javax.xml.ws.wsaddressing.W3CEndpointReference epr =
               ecitSessionRet.newTransaction("774", 150L, "524", "015");


       ECIECITransactionController transController =

eciTransControllerService.getPort(epr,ECIECITransactionController.class);

       ECIStatisticsCORBAService ecisService = new
ECIStatisticsCORBAService();


       if(transController.getState().equals("SUCCESS"))
       {
           epr = transController.getStatisticalInformation();
           ECIStatistics stats =
ecisService.getPort(epr,ECIStatistics.class);

           exchange.getOut.setBody(stats);


       }
catch(......)

finally(.....)

       ............
       .......

}

However, this solution doesn't provide the flexibility expected from camel.
The better solution would be something like this:

.choice()
        .when(bean("EmLoginBean","isLoggedIn").isNotEqualTo(constant(true)))

            .doTry()
                .process(new EmLoginProcessor())    // Try to get a "Session
object"
                .to(cxfSessionFactory)     // Invoked createSession
                .process(new ProcessNewTransaction())     // Got the
sessionObject and try to call sessionObject.newTransaction()
                .to(cxfSessionFactory)   //  Here I get
"CORBA.BAD_OPERATION" exception
                .process(new TransactionResp())
                .choice().when().simple("${in.body.state} == 'FAILED')
                            .to("activemq:FailedTransactions")
               .end()
                .process(new StatisticsReq())
                .to(cxfSessionFactory)
                .process(new StatisticsResp());
                .choice().when().simple("${in.body.state} == 'FAILED')
                            .to("activemq:FailedStatistics")
               .end()
           .doCatch(InvalidLoginCredentials.class)
            ............
            ........


When I try such a solution it fails giving me this CORBA error:
     org.omg.CORBA.BAD_OPERATION:   vmcid: 0x45520000  minor code: 4
 completed: No

I think this is due to a problem with associating the response object from a
previous call with the next operation invocation. What do you think?

Thanks,




On Wed, Aug 18, 2010 at 12:27 PM, Willem.Jiang [via Camel] <
ml-node+2639222-1625143626-45138@n5.nabble.com<ml...@n5.nabble.com>
> wrote:

> Can you try to use CXF to invoke the CORBA service first?
> I'm not sure the CXF can talk the CORBA server rightly.
>
> Willem
>
> M.Ismail wrote:
>
> > Hi,
> >
> > I'm using camel 2.3 to communicate with a CORBA server. I have generated
> a
> > WSDL from the IDLs and then the java stubs from the WSDL and I ran the
> > generated client without a problem. The client simply attempt to create a
>
> > session from and after receiving a session object it uses it to invoke
> some
> > operations. Here is the CXF code:
> >
> >            ECITECITSessionCORBAService ecitSessionService = new
> > ECITECITSessionCORBAService(wsdlURL, ECIT_SERVICE_NAME);
> >         ECITECITSession ecitSession =
> > ecitSessionService.getECITECITSessionCORBAPort();
> >
> >             java.lang.String _createSession_aInterface = "intf1";
> >             java.lang.String _createSession_aUsername = "user1";
> >             java.lang.String _createSession_aPassword = "password";
> >             try {
> >                 javax.xml.ws.wsaddressing.W3CEndpointReference
> > _createSession__return = null;
> >
> >                _createSession__return = ecitSession.createSession("ECIT",
>
> >               _createSession_aUsername,
> > _createSession_aPassword);
> >
> >                ECITECITSession ecitSessionRet =
> > ecitSessionService.getPort(_createSession__return,ECITECITSession.class);
>
> >                System.out.println("Result: "+_createSession__return);
> >
> >                javax.xml.ws.wsaddressing.W3CEndpointReference epr =
> >               ecitSessionRet.newTransaction("774", 150L, "524", "015");
>
> >
> >                ECIECITransactionController transController =
> >
> > eciTransControllerService.getPort(epr,ECIECITransactionController.class);
>
> >
> > and Here is how I tried to port this code to camel:
> >
> > String cxfSessionFactory = "cxf://corbaname::"+confBean.getEmIP()+":"+
> > confBean.getEmPort()+ "#ECISessionFactory?"+
> > "serviceClass="+ cxf.ECITECITSession.class.getName()+
> > "&dataFormat=POJO"+
> > "&portName={http://www.its.ws <http://www.its.ws?by-user=t>}ECIT.ECITSessionCORBAPort"+
>
> > "&serviceName={http://www.its.ws <http://www.its.ws?by-user=t>}ECIT.ECITSessionCORBAService"+
>
> > "&wsdlURL="+confBean.getEmWSDL();
> >
> >     String cxfNewTransaction =
> "cxf://corbaname::"+confBean.getEmIP()+":"+
> > confBean.getEmPort()+ "#ECISessionFactory?"+
> > "serviceClass="+ cxf.ECITECITSession.class.getName()+
> > "&dataFormat=POJO"+
> > "&portName={http://www.its.ws <http://www.its.ws?by-user=t>}ECIT.ECITSessionCORBAPort"+
>
> > "&serviceName={http://www.its.ws <http://www.its.ws?by-user=t>}ECIT.ECITSessionCORBAService"+
>
> > "&wsdlURL="+confBean.getEmWSDL();
> >
> >
> >
> >     from("direct:processEmRequests")
> >     .routeId("Em sub route")
> >     .unmarshal(jaxbUrrFinalApi)
> >
> >     .choice()
> >     .when(bean("EmLoginBean","isLoggedIn").isNotEqualTo(constant(true)))
> >
> >     .doTry()
> >     .process(new EmLoginProcessor())
> >     .to(cxfSessionFactory)
> >     .process(new UrrXmlReqToEmProcessor())
> >     .to(cxfNewTransaction )
> >     .to("direct:processEmResp")
> >     .doCatch(ECIEPermissionDenied.class,ECIESystemDown.class)
> >     .process(new ExceptionProcessorHandler())
> >     .end()
> >
> >     .end();
> >
> > As you notice I'm using the "cxf://corbaname?" to refer to the name of
> the
> > CORBA object that I want to get a reference of e.g when creating a
> session I
> > use "ECISessionFactory". In both the cxf and Camel I'm able to invoke
> > createSession operation and get the return value successfully. However,
> the
> > problem here is that in camel after I get the session and try to invoke
> > newTransaction I get the following CORBA exception:
> >
> > org.omg.CORBA.BAD_OPERATION:   vmcid: 0x45520000  minor code: 4
>  completed:
> > No
> >
> > I used WireShark to sniff the GIOP packet try to know the reason and I
> found
> > that in Camel's case instead of calling the operation "newTransaction"
> > directly, a call to "_is_a" then a call to "resolve_str" then finally a
> call
> > to "newTransaction" which fails giving the above CORBA exception. I'm not
>
> > sure what is the problem here. Can anyone help?
> >
> > Thanks,
> >
> >
>
>
>
> ------------------------------
>  View message @
> http://camel.465427.n5.nabble.com/CXF-CORBA-binding-problem-tp2638356p2639222.html
> To start a new topic under Camel - Users, email
> ml-node+465428-424999138-45138@n5.nabble.com<ml...@n5.nabble.com>
> To unsubscribe from Camel - Users, click here<http://camel.465427.n5.nabble.com/template/NodeServlet.jtp?tpl=unsubscribe_by_code&node=465428&code=bW9oYW1tZWQuaGFueUBnbWFpbC5jb218NDY1NDI4fDIwNzI5Nzg2NDM=>.
>
>
>

-- 
View this message in context: http://camel.465427.n5.nabble.com/CXF-CORBA-binding-problem-tp2638356p2639277.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CXF CORBA binding problem

Posted by Willem Jiang <wi...@gmail.com>.
Can you try to use CXF to invoke the CORBA service first?
I'm not sure the CXF can talk the CORBA server rightly.

Willem

M.Ismail wrote:
> Hi, 
> 
> I'm using camel 2.3 to communicate with a CORBA server. I have generated a
> WSDL from the IDLs and then the java stubs from the WSDL and I ran the
> generated client without a problem. The client simply attempt to create a
> session from and after receiving a session object it uses it to invoke some
> operations. Here is the CXF code: 
> 
>            ECITECITSessionCORBAService ecitSessionService = new
> ECITECITSessionCORBAService(wsdlURL, ECIT_SERVICE_NAME);
>         ECITECITSession ecitSession =
> ecitSessionService.getECITECITSessionCORBAPort();  
> 
>             java.lang.String _createSession_aInterface = "intf1";
>             java.lang.String _createSession_aUsername = "user1";
>             java.lang.String _createSession_aPassword = "password";
>             try {
>                 javax.xml.ws.wsaddressing.W3CEndpointReference
> _createSession__return = null;
>                
>                _createSession__return = ecitSession.createSession("ECIT", 
>             		   										_createSession_aUsername,
> _createSession_aPassword);
>                
>                ECITECITSession ecitSessionRet =
> ecitSessionService.getPort(_createSession__return,ECITECITSession.class);
>                System.out.println("Result: "+_createSession__return);
>                
>                javax.xml.ws.wsaddressing.W3CEndpointReference epr =
>             	   ecitSessionRet.newTransaction("774", 150L, "524", "015");            
>                
>                ECIECITransactionController transController = 
> 				
> eciTransControllerService.getPort(epr,ECIECITransactionController.class);
> 
> and Here is how I tried to port this code to camel:
> 
> String cxfSessionFactory = "cxf://corbaname::"+confBean.getEmIP()+":"+
> confBean.getEmPort()+ "#ECISessionFactory?"+
> 									"serviceClass="+ cxf.ECITECITSession.class.getName()+									
> 									"&dataFormat=POJO"+
> 									"&portName={http://www.its.ws}ECIT.ECITSessionCORBAPort"+
> 									"&serviceName={http://www.its.ws}ECIT.ECITSessionCORBAService"+
> 									"&wsdlURL="+confBean.getEmWSDL();
>     	
>     	String cxfNewTransaction = "cxf://corbaname::"+confBean.getEmIP()+":"+
> confBean.getEmPort()+ "#ECISessionFactory?"+
> 		"serviceClass="+ cxf.ECITECITSession.class.getName()+									
> 		"&dataFormat=POJO"+
> 		"&portName={http://www.its.ws}ECIT.ECITSessionCORBAPort"+
> 		"&serviceName={http://www.its.ws}ECIT.ECITSessionCORBAService"+
> 		"&wsdlURL="+confBean.getEmWSDL();
>     	
>     	
>     	    	
>     	from("direct:processEmRequests")
>     	.routeId("Em sub route")
>     	.unmarshal(jaxbUrrFinalApi)
>     	
>     	.choice()
>     	.when(bean("EmLoginBean","isLoggedIn").isNotEqualTo(constant(true)))
>     	
>     		.doTry()
>     			.process(new EmLoginProcessor())
>     			.to(cxfSessionFactory)    
>     			.process(new UrrXmlReqToEmProcessor())
>     			.to(cxfNewTransaction )
>     			.to("direct:processEmResp")
>     		.doCatch(ECIEPermissionDenied.class,ECIESystemDown.class)
>     		.process(new ExceptionProcessorHandler())
>     		.end()
> 
>     	.end();
> 
> As you notice I'm using the "cxf://corbaname?" to refer to the name of the
> CORBA object that I want to get a reference of e.g when creating a session I
> use "ECISessionFactory". In both the cxf and Camel I'm able to invoke
> createSession operation and get the return value successfully. However, the
> problem here is that in camel after I get the session and try to invoke
> newTransaction I get the following CORBA exception:
> 
> org.omg.CORBA.BAD_OPERATION:   vmcid: 0x45520000  minor code: 4  completed:
> No
> 
> I used WireShark to sniff the GIOP packet try to know the reason and I found
> that in Camel's case instead of calling the operation "newTransaction"
> directly, a call to "_is_a" then a call to "resolve_str" then finally a call
> to "newTransaction" which fails giving the above CORBA exception. I'm not
> sure what is the problem here. Can anyone help?
> 
> Thanks,
> 
>