Eoghan: When I request the WSDL from the appserver using this URL: http://localhost:8080/rmdemo/greet?wsdl
CXF seems to change the <soap:address> from http://localhost:9000/SoapContext/GreeterPort to the correct URL that serves up the service. Here is the service portion: <wsdl:service name="GreeterService"> <wsdl:port binding="tns:Greeter_SOAPBinding" name="GreeterPort"> <soap:address location="http://localhost:8080/rmdemo/greet"/> <wswa:UsingAddressing/> </wsdl:port> </wsdl:service> I have taken TCPMON out of the loop, so the client is doing the following: String SERVICE_ADDRESS = "http://localhost:8080/rmdemo/greet"; GreeterService service = new GreeterService(); Greeter port = service.getGreeterPort(); BindingProvider bp = (BindingProvider) port; SOAPBinding binding = (SOAPBinding)bp.getBinding(); binding.setMTOMEnabled(false); Map<String, Object> rc = bp.getRequestContext(); rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, SERVICE_ADDRESS); rc.put(SOAPBinding.SOAP12HTTP_BINDING,true); Still get the same error... PS: Does CXF support WS-RM 1.1/2007 or have future plans to do so. The project we are going to integrate with is planning on using this version. Thanks for all the help! Mike -----Original Message----- From: Eoghan Glynn [mailto:[EMAIL PROTECTED] Sent: Sat 6/28/2008 7:57 AM To: [email protected] Subject: Re: WS-RM enabling in CXF Barlotta, Michael [USA] wrote: > Eoghan: > > Thanks... that seems to have cleared things up...(looks like it is actually > trying to do WS-RM now) > Now I am getting the following error: > > INFO: Action : http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence > Jun 27, 2008 3:59:29 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept > INFO: Interceptor has thrown exception, unwinding now > org.apache.cxf.interceptor.Fault: Connection refused: connect Sounds like an address mis-configuration. If you're using tcpmon, ensure the client's WSDL reflects the tcpmon listen address. Say the server is listening on port 9000. Add a listener in tcpmon with: - target port 9000 - listen port 8999 - reconfigure your client to invoke on port 8999 The last step may be acheived by either changing the <soap:address> in the client's WSDL, or by overriding the target address in code via the BindingProvider.ENDPOINT_ADDRESS_PROPERTY. > I have the JBoss AS running with the Service, I have even setup TCPMON but > the client does not seem to be able to send the WS-RM requests. > > On a separate note, is there some reason why the use of the XML file was not > setting the interceptors, that is the only reason I switched over to manual > mode... :) > Original code shown below: > > SpringBusFactory bf = new SpringBusFactory(); > Bus bus = bf.createBus("cxf_rm_client.xml"); > bf.setDefaultBus(bus); > > List<Interceptor> inList = bus.getInInterceptors(); > System.out.println("Num In Interceptors:"+inList.size()); > > // OUTPUT: > Num In Interceptors:0 Can you forward your cxf_rm_client.xml? > On another note, does CXF client automatically handle WS-RM if the WSDL has > the policy in it and the interceptors have not been added? Asserting the policy in the WSDL /should/ result in the interceptors being transparently added by the RM PolicyInterceptorProvider. /Eoghan > Thanks, > Mike > > -----Original Message----- > From: Eoghan Glynn [mailto:[EMAIL PROTECTED] > Sent: Fri 6/27/2008 3:01 PM > To: [email protected] > Subject: Re: WS-RM enabling in CXF > > > Mike, > > When adding the interceptors manually, you have to be careful to ensure > that the *same* instance of each interceptor type is added to each list > .... something like: > > MAPAggregator mapAggregator = new MAPAggregator(); > MAPCodec mapCodec = new MAPCodec(); > > bus.getInInterceptors().add(mapAggregator); > bus.getInInterceptors().add(mapCodec); > > bus.getOutInterceptors().add(mapAggregator); > bus.getOutInterceptors().add(mapCodec); > > bus.getInFaultInterceptors().add(mapAggregator); > bus.getInFaultInterceptors().add(mapCodec); > > bus.getOutFaultInterceptors().add(mapAggregator); > bus.getOutFaultInterceptors().add(mapCodec); > > RMInInterceptor rmIn = new RMInInterceptor(); > RMOutInterceptor rmOut = new RMOutInterceptor(); > RMSoapInterceptor rmCodec = new RMSoapInterceptor(); > > rmIn.setBus(bus); > rmOut.setBus(bus); > > bus.getInInterceptors().add(rmIn); > bus.getInInterceptors().add(rmSoap); > > bus.getOutInterceptors().add(rmOut); > bus.getOutInterceptors().add(rmCodec); > > bus.getInFaultInterceptors().add(rmIn); > bus.getInFaultInterceptors().add(rmCodec); > > bus.getOutFaultInterceptors().add(rmOut); > bus.getOutFaultInterceptors().add(rmCodec); > > Order of addition to these list shouldn't matter, as the Interceptor > phase & getBefore/getAfter() mechanisms will ensure that interceptors > are correctly ordered when a chain is assembled for an invocation. > > Note the calls to setBus() on the RM interceptors, this will avoid the > NPE you're seeing: > > > java.lang.NullPointerException > > at org.apache.cxf.ws.rm.AbstractRMInterceptor.getManager( > > AbstractRMInterceptor.java:56) > > Finally, if you're adding the interceptors explicitly in code, you > shouldn't /also/ be asserting the RM/Adressing policies or features in > the cxf_rm_client.xml client config. > > /Eoghan > > > Barlotta, Michael [USA] wrote: >> Eoghan: >> >> Thanks for the help, here is where I am so far... >> >> <Quote> >> You're getting these errors on the server-side right? >> </Quote> >> Yes. >> >> <Quote> >> Are you using WSDL-first or Java-first? >> If WSDL-first, does your WSDL include the <wsam:UsingAddressing> >> extension element? (see the ws_rm sample WSDL) >> </Quote> >> WSDL-first. I am actually using the ws-rm samples WSDL. >> >> <Quote> >> Which implies that WS-A (and possibly WS-RM also) is not being properly >> enabled on the client-side. >> </Quote> >> >> Funny thing, I dumped the interceptors on the client and there are >> none... >> SpringBusFactory bf = new SpringBusFactory(); >> Bus bus = bf.createBus("cxf_rm_client.xml"); >> bf.setDefaultBus(bus); >> >> List<Interceptor> inList = bus.getInInterceptors(); >> System.out.println("Num In Interceptors:"+inList.size()); >> // Num In Interceptors:0 >> >> >> List<Interceptor> outList = bus.getOutInterceptors(); >> System.out.println("Num Out Interceptors:"+outList.size()); >> // Num Out Interceptors:0 >> >> I added them via code as follows: >> inList.add(new >> org.apache.cxf.interceptor.LoggingInInterceptor()); >> inList.add(new >> org.apache.cxf.ws.addressing.MAPAggregator()); >> inList.add(new >> org.apache.cxf.ws.addressing.soap.MAPCodec()); >> inList.add(new org.apache.cxf.ws.rm.RMInInterceptor()); >> inList.add(new >> org.apache.cxf.ws.rm.soap.RMSoapInterceptor()); >> >> outList.add(new >> org.apache.cxf.interceptor.LoggingOutInterceptor()); >> outList.add(new >> org.apache.cxf.ws.addressing.MAPAggregator()); >> outList.add(new >> org.apache.cxf.ws.addressing.soap.MAPCodec()); >> outList.add(new org.apache.cxf.ws.rm.RMOutInterceptor()); >> outList.add(new >> org.apache.cxf.ws.rm.soap.RMSoapInterceptor()); >> >> >> Does it matter what order I add the Interceptors? >> >> >> Doing this I get the following errors (client side - there is nothing on >> the server): >> >> Jun 27, 2008 10:11:51 AM >> org.apache.cxf.service.factory.ReflectionServiceFactoryBean >> buildServiceFromWSDL >> INFO: Creating Service >> {http://cxf.apache.org/hello_world_soap_http}GreeterService from WSDL: >> file:src/wsdl/hello_world_rm.wsdl >> Jun 27, 2008 10:11:52 AM >> org.apache.cxf.ws.addressing.ContextUtils retrieveMAPs >> INFO: retrieving MAPs from context property >> javax.xml.ws.addressing.context >> Jun 27, 2008 10:11:52 AM >> org.apache.cxf.ws.addressing.MAPAggregator getMAPs >> INFO: MAPs retrieved from message null >> Jun 27, 2008 10:11:52 AM >> org.apache.cxf.ws.addressing.ContextUtils storeMAPs >> INFO: associating MAPs with context property >> javax.xml.ws.addressing.context.outbound >> Jun 27, 2008 10:11:52 AM >> org.apache.cxf.ws.addressing.ContextUtils retrieveMAPs >> INFO: retrieving MAPs from context property >> javax.xml.ws.addressing.context.outbound >> Jun 27, 2008 10:11:52 AM >> org.apache.cxf.ws.addressing.ContextUtils retrieveMAPs >> INFO: current MAPs [MessageId: >> urn:uuid:9ab9a836-ccf9-4bd0-b0b1-1d6c9b73f01c, Action: >> http://cxf.apache.org/hello_world_soap_http/Greeter/sayHiRequest, To: >> http://localhost:9000/SoapContext/GreeterPort, ReplyTo: >> http://www.w3.org/2005/08/addressing/anonymous, FaultTo: >> http://www.w3.org/2005/08/addressing/anonymous] >> Jun 27, 2008 10:11:52 AM >> org.apache.cxf.ws.addressing.ContextUtils retrieveMAPs >> INFO: retrieving MAPs from context property >> javax.xml.ws.addressing.context.outbound >> Jun 27, 2008 10:11:52 AM >> org.apache.cxf.ws.addressing.ContextUtils retrieveMAPs >> INFO: current MAPs [MessageId: >> urn:uuid:9ab9a836-ccf9-4bd0-b0b1-1d6c9b73f01c, Action: >> http://cxf.apache.org/hello_world_soap_http/Greeter/sayHiRequest, To: >> http://localhost:9000/SoapContext/GreeterPort, ReplyTo: >> http://www.w3.org/2005/08/addressing/anonymous, FaultTo: >> http://www.w3.org/2005/08/addressing/anonymous] >> Jun 27, 2008 10:11:52 AM >> org.apache.cxf.phase.PhaseInterceptorChain doIntercept >> INFO: Interceptor has thrown exception, unwinding now >> java.lang.NullPointerException >> at >> org.apache.cxf.ws.rm.AbstractRMInterceptor.getManager(AbstractRMIntercep >> tor.java:56) >> >> Any ideas on what causes this error? >> >> Right now I am using the CXF logging to look for the WS-A and WS-RM >> elements in the SOAP to verify that all is working. I have used TCPMON >> in the past and will try that too. >> >> PS: sorry for the double post... >> >> Mike Barlotta >> Associate >> Booz | Allen | Hamilton >> >> -----Original Message----- >> From: Eoghan Glynn [mailto:[EMAIL PROTECTED] >> Sent: Friday, June 27, 2008 5:50 AM >> To: [email protected] >> Subject: Re: WS-RM enabling in CXF >> >> Barlotta, Michael [USA] wrote: >>> After digging and playing there are at least two options (there may be >>> more) to configure WS-RM >>> 1) adding interceptors to the CXF bus >>> 2) adding policy to the endpoint >>> >>> I have not gotten very far with option 1, though I am not sure why. >>> The Greeter service from the samples ws-rm directory works, but no >>> addressing/reliable messaging calls are taking place. >>> >>> I have switched to using WS-Policy. (attached is the server side >>> Spring context file). >>> I still get the addressing errors... >>> >>> 16:13:59,096 ERROR [STDERR] Jun 26, 2008 4:13:59 PM >>> org.apache.cxf.ws.addressing.ContextUtils retrieveMAPs >>> WARNING: WS-Addressing - failed to retrieve Message Addressing >>> Properties from context >>> >>> >>> I also get this error: >>> 16:13:59,346 ERROR [STDERR] Jun 26, 2008 4:13:59 PM >>> org.apache.cxf.phase.PhaseInterceptorChain doIntercept >>> INFO: Interceptor has thrown exception, unwinding now >>> org.apache.cxf.interceptor.Fault: None of the policy alternatives can >>> be satisfied. >>> at >>> org.apache.cxf.ws.policy.AbstractPolicyInterceptor.handleMessage(Abstr >>> ac >>> tPolicyInterceptor.java:58) >> >> >> Mike, >> >> You're getting these errors on the server-side right? >> >> This implies that WS-A is indeed enabled on the server-side, but the >> headers that WS-A expects are missing from the incoming request payload. >> >> Which implies that WS-A (and possibly WS-RM also) is not being properly >> enabled on the client-side. >> >> You can confirm this by interposing tcpmon between client and server so >> as to inspect the payload. Details on how to do this were discussed on >> these lists recently[1]. Or can you just look at the server-side logging >> output, if the <cxf:logging/> feature is set on the endpoint. You'll be >> looking for WS-A elements in the <soap:Header>, such as <MessageID> and >> <ReplyTo>, also for WS-RM elements such as <wsrm:Sequence>. >> >> Assuming it turns out that the WS-A/RM headers are indeed missing from >> the client's request payload, the next step is to figure out why. >> >> Are you using WSDL-first or Java-first? >> >> If WSDL-first, does your WSDL include the <wsam:UsingAddressing> >> extension element? (see the ws_rm sample WSDL) >> >> If Java-first, try enabling WS-A by setting the <wsam:Addressing> >> policy, *OR* the CXF <wsa:addressing> feature, on the <jaxws:client> >> bean in the client config (instead of manually adding the interceptors >> to the Bus-level chains). >> >> Cheers, >> Eoghan >> >> [1] http://www.nabble.com/View-SOAP-Messages-to17812716.html#a17820449 >> >> >> >>> Similar to this JIRA issue: (though I did not add the policy to the >>> WSDL, I am using the one supplied in the samples directory of CXF) >>> http://issues.apache.org/jira/browse/CXF-1311 >>> >>> This is what the client looks like: the client Spring file is similar >>> to the one posted earliar (interceptors attached to the bus). >>> >>> SpringBusFactory bf = new SpringBusFactory(); >>> Bus bus = bf.createBus("cxf_rm_client.xml"); >>> bf.setDefaultBus(bus); >>> >>> GreeterService service = new GreeterService(); >>> Greeter port = service.getGreeterPort(); >>> >>> // Use Proxy Instance as BindingProvider >>> BindingProvider bp = (BindingProvider) port; >>> // enable MTOM >>> SOAPBinding binding = (SOAPBinding)bp.getBinding(); >>> binding.setMTOMEnabled(false); >>> // (Optional) Configure RequestContext with endpoint's >> URL >>> Map<String, Object> rc = bp.getRequestContext(); >>> rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, >>> SERVICE_ADDRESS); >>> rc.put(SOAPBinding.SOAP12HTTP_BINDING,true); >>> >>> String response = port.sayHi(); >>> >>> Thanks, >>> >>> Mike Barlotta >>> Associate >>> Booz | Allen | Hamilton >>> > > ---------------------------- > IONA Technologies PLC (registered in Ireland) > Registered Number: 171387 > Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland > > > ---------------------------- IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
