You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Mark Edwards <ma...@orchard-systems.co.uk> on 2007/08/22 17:51:44 UTC

NullPointerException with REST client call using JAX-WS Dispatch

Hi

 

I'm getting the following exception when trying to call one of Amazon's REST
webservices using the JAX-WS Dispatch approach.

 

 

22-Aug-2007 15:52:18
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromClass

INFO: Creating Service
{http://webservices.amazon.com/AWSECommerceService/2005-10-05}amazon_service
from class org.apache.cxf.jaxws.support.DummyImpl

Exception in thread "main" java.lang.NullPointerException

            at
org.apache.cxf.jaxws.ServiceImpl.createEndpointInfo(ServiceImpl.java:358)

            at
org.apache.cxf.jaxws.ServiceImpl.getJaxwsEndpoint(ServiceImpl.java:137)

            at
org.apache.cxf.jaxws.ServiceImpl.createDispatch(ServiceImpl.java:188)

            at javax.xml.ws.Service.createDispatch(Service.java:166)

            at
uk.co.orchardsystems.webservices.client.call.DispatchServiceCall.resfFulCall(
DispatchServiceCall.java:98)

            at
uk.co.orchardsystems.webservices.client.test.AmazonRestFulClient.main(AmazonR
estFulClient.java:51)

 

 

My code works fine if I remove CXF from the classpath and run it using the
JAX-WS implementation that comes with Java 6.

 

 

The main calling method in my code is - 

 

public Document resfFulCall(RestFulCallParams callParams)

            throws WebserviceClientCallException {

        BindingDefinition binding = getServiceCallRequest().getBinding();

        QName portName = binding.getPortName();

        URL endpointAddress = binding.getEndpointAddress();

        String fullURL = null;

        String queryStringPostFix = callParams.getUrlPostFix();

        if (queryStringPostFix != null) {

            fullURL = endpointAddress.toString() + queryStringPostFix;

        } else {

            fullURL = endpointAddress.toString();

        }

 

        Service service = getService();

        service.addPort(portName, HTTPBinding.HTTP_BINDING, fullURL);

        Dispatch<Source> dispatch = service.createDispatch(portName,
Source.class, Service.Mode.PAYLOAD);

        Map<String, Object> requestContext = dispatch.getRequestContext();

        requestContext.put(MessageContext.HTTP_REQUEST_METHOD,
callParams.getVerb().getVerbName());

        return payLoadInvoke(dispatch, callParams.getPayload());

}

 

Supporting methods - 

 

protected Service getService() {

        ServiceDefinition serviceDefinition =
serviceCallRequest.getBinding().getService();

        QName serviceName = serviceDefinition.getServiceName();

        URL wsdlURL = serviceDefinition.getWsdlURL();

        Service service;

        if (wsdlURL == null) {

            service = Service.create(serviceName);

        } else {

            service = Service.create(wsdlURL, serviceName);

        }

 

        service.setHandlerResolver(new
ClientHandlerResolver(serviceCallRequest));

 

        return service;

}

 

private Document payLoadInvoke(Dispatch<Source> dispatch, Document payload)

            throws WebserviceClientCallException {

        DOMSource request = new DOMSource(payload);

 

        Source response = null;

        try {

            response = dispatch.invoke(request);

        } catch (Throwable t) {

            processException(t);

        }

 

        try {

            return XMLUtils.domSourceToDocument(response);

        } catch (TransformerConfigurationException e) {

            throw new WebserviceClientCallException(e);

        } catch (TransformerFactoryConfigurationError e) {

            throw new WebserviceClientCallException(e);

        } catch (TransformerException e) {

            throw new WebserviceClientCallException(e);

        }

}

 

Relevant values - 

 

Service name = new
QName("http://webservices.amazon.com/AWSECommerceService/2005-10-05",
"amazon_service") 

Port name = new
QName("http://webservices.amazon.com/AWSECommerceService/2005-10-05",
"amazon_port")

(I wasn't completely sure what to set these to for a RESTful call but they
seem to work when not using CXF)

 

endPointAddress =
http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=
[will
<http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId
=%5bwill>  need to add a valid access ID here if you want to use this
URL]&Operation=ItemSearch&SearchIndex=Books&Title=Harry%20Potter

 

queryStringPostFix = null

 

 

 

I'm running the 2.0 version of CXF.

 

 

 

The problem appears to be in the following bit of code - 

 

private EndpointInfo createEndpointInfo(AbstractServiceFactoryBean
serviceFactory, 

                                            QName portName,

                                            PortInfoImpl portInfo) throws
BusException {

        EndpointInfo ei = null;               

        String address = portInfo.getAddress();

       

        DestinationFactoryManager dfm =
bus.getExtension(DestinationFactoryManager.class);

        DestinationFactory df =
dfm.getDestinationFactoryForUri(portInfo.getAddress());

 

        String transportId = df.getTransportIds().get(0);

        String bindingID = BindingID.getBindingID(portInfo.getBindingID());

                

        Object config = null;

        if (serviceFactory instanceof JaxWsServiceFactoryBean) {

            config = new
JaxWsSoapBindingConfiguration((JaxWsServiceFactoryBean)serviceFactory);

        }

        BindingInfo bindingInfo =
bus.getExtension(BindingFactoryManager.class).getBindingFactory(bindingID)

                .createBindingInfo(serviceFactory.getService(), bindingID,
config);

 

 

        Service service = serviceFactory.getService();

        service.getServiceInfos().get(0).addBinding(bindingInfo);

 

        ei = new EndpointInfo(service.getServiceInfos().get(0), transportId);

        ei.setName(portName);

        ei.setAddress(address);

        ei.setBinding(bindingInfo);

 

        service.getServiceInfos().get(0).addEndpoint(ei);

        return ei;

    }

 

The DestinationFactory df is null because the DestinationFactoryManger
instance has an empty Map of destinationFactories.  But maybe it shouldn't
have got to this point in the first place and the problem is really in
ServiceImpl. getJaxwsEndpoint.

 

I hope this is enough information to look into the problem and see what I've
done wrong.

 

 

Thanks in anticipation.

 

Mark

 

 

Mark Edwards

Orchard Information Systems Limited, 
Newcastle Technopole, Kings Manor, 
Newcastle upon Tyne, 
NE1 6PA 
United Kingdom. 
Registered in England, Number 1900078 
Tel: +44 (0)191-203 2500  Fax: +44 (0)191-230 2515 
http://www.orchard-systems.co.uk <http://www.orchard-systems.co.uk/>  

 


This e-mail and any files transmitted are confidential and is solely for the intended recipient. Unauthorised use, dissemination, distribution, copying, reproduction, modification or publication is strictly prohibited. If you have received this e-mail in error, please notify the sender and permanently delete the e-mail from your system. 
Opinions expressed in this e-mail are those of the individual and not necessarily those of Orchard Information Systems Ltd. 

It is the responsibility of the recipient to ensure this e-mail is free from viruses. Orchard Information Systems Ltd accept no liability for any damage caused by any virus transmitted by this e-mail. 

Incoming and outgoing e-mail messages are routinely monitored for compliance with Orchard Information Systems Ltd's Internet Usage Policy.

Orchard Information Systems Ltd. Registered in England No. 1900078
Newcastle Technopole, Kings Manor, Newcastle upon Tyne, NE1 6PA

Please consider the environment before printing this e-mail. 



Re: NullPointerException with REST client call using JAX-WS Dispatch

Posted by Daniel Kulp <dk...@apache.org>.
Mark,

One more question:  is the spring jars on the classpath?   

I'm seeing a similar stack trace when using the ExtensionBus instead of 
the Spring bus.   I'm working on a fix for that now so that fix may fix 
your issue.

Dan


On Tuesday 04 September 2007, Daniel Kulp wrote:
> Mark,
>
> Have you tried this with trunk?   I tried this with trunk and I'm not
> getting any errors or stack traces.  (it didn't work, but that's
> probably cause I don't have an ID so just put junk in there for that).
> I've attached the simple "Client" I'm using.    Can you take a quick
> look to make sure I didn't mess something up and that the queries and
> stuff more or less match what you are doing?
>
> Thanks!
> Dan
>
> On Tuesday 28 August 2007, Mark Edwards wrote:
> > Hi Dan
> >
> > Thanks for the reply.  The answers to your questions are -
> >
> > 1) The WSDL URL is null.
> >
> > I have subsequently tried to call some RPC encoded webservices using
> > Dispatch and creating the Service without a WSDL and this gets the
> > same error under CXF but works with the RI.  So, as you have
> > probably already realised, the lack of a WSDL looks like an
> > important part of the problem.
> >
> > 2) URL endpointAddress =
> > http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAcc
> >es sKeyId= [will need to add a valid access ID here if you want to
> > use this
> > URL]&Operation=ItemSearch&SearchIndex=Books&Title=Harry%20Potter
> >
> > I can provide my Access Key if you need to use the above URL.
> >
> > String queryStringPostFix = null;
> >
> > callParams.getVerb().getVerbName() = "POST";
> >
> > callParams.getPayload() = null;
> >
> >
> > Best Regards
> >
> > Mark
> >
> >
> >
> > -----Original Message-----
> > From: Daniel Kulp [mailto:dkulp@apache.org]
> > Sent: 24 August 2007 18:01
> > To: cxf-user@incubator.apache.org
> > Cc: Mark Edwards
> > Subject: Re: NullPointerException with REST client call using JAX-WS
> > Dispatch
> >
> >
> > Mark,
> >
> > I think I need some more details:
> >
> > 1) Are you using a WSDL URL or not for the call at:
> >  if (wsdlURL == null) {
> >           service = Service.create(serviceName);
> >  } else {
> >           service = Service.create(wsdlURL, serviceName);
> >  }
> > That's important.   If you ARE using a WSDL URL, the serviceName and
> > portnames will have to match whats in the WSDL.   If you are using
> > the WSDL URL, could you send me that?    The url on amazons site is:
> > http://webservices.amazon.com/AWSECommerceService/AWSECommerceServic
> >e. wsdl? but that has a namespace of:
> > http://webservices.amazon.com/AWSECommerceService/2007-07-16
> > so I assume it's new than what you were trying to use.
> >
> >
> > 2) Can you also send me the values you are using for:
> >
> >         URL endpointAddress = binding.getEndpointAddress();
> >         String queryStringPostFix = callParams.getUrlPostFix();
> >         callParams.getVerb().getVerbName()
> >         callParams.getPayload()
> >
> > Thanks!
> > Dan
> >
> > On Wednesday 22 August 2007, Mark Edwards wrote:
> > > Hi
> > >
> > >
> > >
> > > I'm getting the following exception when trying to call one of
> > > Amazon's REST webservices using the JAX-WS Dispatch approach.
> > >
> > >
> > >
> > >
> > >
> > > 22-Aug-2007 15:52:18
> > > org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> > > buildServiceFromClass
> > >
> > > INFO: Creating Service
> > > {http://webservices.amazon.com/AWSECommerceService/2005-10-05}amaz
> > >on _s ervice from class org.apache.cxf.jaxws.support.DummyImpl
> > >
> > > Exception in thread "main" java.lang.NullPointerException
> > >
> > >             at
> > > org.apache.cxf.jaxws.ServiceImpl.createEndpointInfo(ServiceImpl.ja
> > >va
> > >
> > >:3 58)
> > >
> > >             at
> > > org.apache.cxf.jaxws.ServiceImpl.getJaxwsEndpoint(ServiceImpl.java
> > >:1 37 )
> > >
> > >             at
> > > org.apache.cxf.jaxws.ServiceImpl.createDispatch(ServiceImpl.java:1
> > >88 )
> > >
> > >             at
> > > javax.xml.ws.Service.createDispatch(Service.java:166)
> > >
> > >             at
> > > uk.co.orchardsystems.webservices.client.call.DispatchServiceCall.r
> > >es fF ulCall( DispatchServiceCall.java:98)
> > >
> > >             at
> > > uk.co.orchardsystems.webservices.client.test.AmazonRestFulClient.m
> > >ai n( AmazonR estFulClient.java:51)
> > >
> > >
> > >
> > >
> > >
> > > My code works fine if I remove CXF from the classpath and run it
> > > using the JAX-WS implementation that comes with Java 6.
> > >
> > >
> > >
> > >
> > >
> > > The main calling method in my code is -
> > >
> > >
> > >
> > > public Document resfFulCall(RestFulCallParams callParams)
> > >
> > >             throws WebserviceClientCallException {
> > >
> > >         BindingDefinition binding =
> > > getServiceCallRequest().getBinding();
> > >
> > >         QName portName = binding.getPortName();
> > >
> > >         URL endpointAddress = binding.getEndpointAddress();
> > >
> > >         String fullURL = null;
> > >
> > >         String queryStringPostFix = callParams.getUrlPostFix();
> > >
> > >         if (queryStringPostFix != null) {
> > >
> > >             fullURL = endpointAddress.toString() +
> > > queryStringPostFix;
> > >
> > >         } else {
> > >
> > >             fullURL = endpointAddress.toString();
> > >
> > >         }
> > >
> > >
> > >
> > >         Service service = getService();
> > >
> > >         service.addPort(portName, HTTPBinding.HTTP_BINDING,
> > > fullURL);
> > >
> > >         Dispatch<Source> dispatch =
> > > service.createDispatch(portName, Source.class,
> > > Service.Mode.PAYLOAD);
> > >
> > >         Map<String, Object> requestContext =
> > > dispatch.getRequestContext();
> > >
> > >         requestContext.put(MessageContext.HTTP_REQUEST_METHOD,
> > > callParams.getVerb().getVerbName());
> > >
> > >         return payLoadInvoke(dispatch, callParams.getPayload());
> > >
> > > }
> > >
> > >
> > >
> > > Supporting methods -
> > >
> > >
> > >
> > > protected Service getService() {
> > >
> > >         ServiceDefinition serviceDefinition =
> > > serviceCallRequest.getBinding().getService();
> > >
> > >         QName serviceName = serviceDefinition.getServiceName();
> > >
> > >         URL wsdlURL = serviceDefinition.getWsdlURL();
> > >
> > >         Service service;
> > >
> > >         if (wsdlURL == null) {
> > >
> > >             service = Service.create(serviceName);
> > >
> > >         } else {
> > >
> > >             service = Service.create(wsdlURL, serviceName);
> > >
> > >         }
> > >
> > >
> > >
> > >         service.setHandlerResolver(new
> > > ClientHandlerResolver(serviceCallRequest));
> > >
> > >
> > >
> > >         return service;
> > >
> > > }
> > >
> > >
> > >
> > > private Document payLoadInvoke(Dispatch<Source> dispatch, Document
> > > payload)
> > >
> > >             throws WebserviceClientCallException {
> > >
> > >         DOMSource request = new DOMSource(payload);
> > >
> > >
> > >
> > >         Source response = null;
> > >
> > >         try {
> > >
> > >             response = dispatch.invoke(request);
> > >
> > >         } catch (Throwable t) {
> > >
> > >             processException(t);
> > >
> > >         }
> > >
> > >
> > >
> > >         try {
> > >
> > >             return XMLUtils.domSourceToDocument(response);
> > >
> > >         } catch (TransformerConfigurationException e) {
> > >
> > >             throw new WebserviceClientCallException(e);
> > >
> > >         } catch (TransformerFactoryConfigurationError e) {
> > >
> > >             throw new WebserviceClientCallException(e);
> > >
> > >         } catch (TransformerException e) {
> > >
> > >             throw new WebserviceClientCallException(e);
> > >
> > >         }
> > >
> > > }
> > >
> > >
> > >
> > > Relevant values -
> > >
> > >
> > >
> > > Service name = new
> > > QName("http://webservices.amazon.com/AWSECommerceService/2005-10-0
> > >5" , "amazon_service")
> > >
> > > Port name = new
> > > QName("http://webservices.amazon.com/AWSECommerceService/2005-10-0
> > >5" , "amazon_port")
> > >
> > > (I wasn't completely sure what to set these to for a RESTful call
> > > but they seem to work when not using CXF)
> > >
> > >
> > >
> > > endPointAddress =
> > > http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSA
> > >cc es sKeyId= [will
> > > <http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWS
> > >Ac ce ssKeyId =%5bwill>  need to add a valid access ID here if you
> > > want to use this
> > > URL]&Operation=ItemSearch&SearchIndex=Books&Title=Harry%20Potter
> > >
> > >
> > >
> > > queryStringPostFix = null
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > I'm running the 2.0 version of CXF.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > The problem appears to be in the following bit of code -
> > >
> > >
> > >
> > > private EndpointInfo createEndpointInfo(AbstractServiceFactoryBean
> > > serviceFactory,
> > >
> > >                                             QName portName,
> > >
> > >                                             PortInfoImpl portInfo)
> > > throws BusException {
> > >
> > >         EndpointInfo ei = null;
> > >
> > >         String address = portInfo.getAddress();
> > >
> > >
> > >
> > >         DestinationFactoryManager dfm =
> > > bus.getExtension(DestinationFactoryManager.class);
> > >
> > >         DestinationFactory df =
> > > dfm.getDestinationFactoryForUri(portInfo.getAddress());
> > >
> > >
> > >
> > >         String transportId = df.getTransportIds().get(0);
> > >
> > >         String bindingID =
> > > BindingID.getBindingID(portInfo.getBindingID());
> > >
> > >
> > >
> > >         Object config = null;
> > >
> > >         if (serviceFactory instanceof JaxWsServiceFactoryBean) {
> > >
> > >             config = new
> > > JaxWsSoapBindingConfiguration((JaxWsServiceFactoryBean)serviceFact
> > >or y) ;
> > >
> > >         }
> > >
> > >         BindingInfo bindingInfo =
> > > bus.getExtension(BindingFactoryManager.class).getBindingFactory(bi
> > >nd in gID)
> > >
> > >                 .createBindingInfo(serviceFactory.getService(),
> > > bindingID, config);
> > >
> > >
> > >
> > >
> > >
> > >         Service service = serviceFactory.getService();
> > >
> > >         service.getServiceInfos().get(0).addBinding(bindingInfo);
> > >
> > >
> > >
> > >         ei = new EndpointInfo(service.getServiceInfos().get(0),
> > > transportId);
> > >
> > >         ei.setName(portName);
> > >
> > >         ei.setAddress(address);
> > >
> > >         ei.setBinding(bindingInfo);
> > >
> > >
> > >
> > >         service.getServiceInfos().get(0).addEndpoint(ei);
> > >
> > >         return ei;
> > >
> > >     }
> > >
> > >
> > >
> > > The DestinationFactory df is null because the
> > > DestinationFactoryManger instance has an empty Map of
> > > destinationFactories.  But maybe it shouldn't have got to this
> > > point in the first place and the problem is really in ServiceImpl.
> > > getJaxwsEndpoint.
> > >
> > >
> > >
> > > I hope this is enough information to look into the problem and see
> > > what I've done wrong.
> > >
> > >
> > >
> > >
> > >
> > > Thanks in anticipation.
> > >
> > >
> > >
> > > Mark
> > >
> > >
> > >
> > >
> > >
> > > Mark Edwards
> > >
> > > Orchard Information Systems Limited,
> > > Newcastle Technopole, Kings Manor,
> > > Newcastle upon Tyne,
> > > NE1 6PA
> > > United Kingdom.
> > > Registered in England, Number 1900078
> > > Tel: +44 (0)191-203 2500  Fax: +44 (0)191-230 2515
> > > http://www.orchard-systems.co.uk
> > > <http://www.orchard-systems.co.uk/>
> > >
> > >
> > >
> > >
> > > This e-mail and any files transmitted are confidential and is
> > > solely for the intended recipient. Unauthorised use,
> > > dissemination, distribution, copying, reproduction, modification
> > > or publication is strictly prohibited. If you have received this
> > > e-mail in error, please notify the sender and permanently delete
> > > the e-mail from your system. Opinions expressed in this e-mail are
> > > those of the individual and not necessarily those of Orchard
> > > Information Systems Ltd.
> > >
> > > It is the responsibility of the recipient to ensure this e-mail is
> > > free from viruses. Orchard Information Systems Ltd accept no
> > > liability for any damage caused by any virus transmitted by this
> > > e-mail.
> > >
> > > Incoming and outgoing e-mail messages are routinely monitored for
> > > compliance with Orchard Information Systems Ltd's Internet Usage
> > > Policy.
> > >
> > > Orchard Information Systems Ltd. Registered in England No. 1900078
> > > Newcastle Technopole, Kings Manor, Newcastle upon Tyne, NE1 6PA
> > >
> > > Please consider the environment before printing this e-mail.



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: NullPointerException with REST client call using JAX-WS Dispatch

Posted by Daniel Kulp <dk...@apache.org>.
Mark,

Have you tried this with trunk?   I tried this with trunk and I'm not 
getting any errors or stack traces.  (it didn't work, but that's 
probably cause I don't have an ID so just put junk in there for that).    
I've attached the simple "Client" I'm using.    Can you take a quick 
look to make sure I didn't mess something up and that the queries and 
stuff more or less match what you are doing?

Thanks!
Dan



On Tuesday 28 August 2007, Mark Edwards wrote:
> Hi Dan
>
> Thanks for the reply.  The answers to your questions are -
>
> 1) The WSDL URL is null.
>
> I have subsequently tried to call some RPC encoded webservices using
> Dispatch and creating the Service without a WSDL and this gets the
> same error under CXF but works with the RI.  So, as you have probably
> already realised, the lack of a WSDL looks like an important part of
> the problem.
>
> 2) URL endpointAddress =
> http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAcces
>sKeyId= [will need to add a valid access ID here if you want to use
> this URL]&Operation=ItemSearch&SearchIndex=Books&Title=Harry%20Potter
>
> I can provide my Access Key if you need to use the above URL.
>
> String queryStringPostFix = null;
>
> callParams.getVerb().getVerbName() = "POST";
>
> callParams.getPayload() = null;
>
>
> Best Regards
>
> Mark
>
>
>
> -----Original Message-----
> From: Daniel Kulp [mailto:dkulp@apache.org]
> Sent: 24 August 2007 18:01
> To: cxf-user@incubator.apache.org
> Cc: Mark Edwards
> Subject: Re: NullPointerException with REST client call using JAX-WS
> Dispatch
>
>
> Mark,
>
> I think I need some more details:
>
> 1) Are you using a WSDL URL or not for the call at:
>  if (wsdlURL == null) {
>           service = Service.create(serviceName);
>  } else {
>           service = Service.create(wsdlURL, serviceName);
>  }
> That's important.   If you ARE using a WSDL URL, the serviceName and
> portnames will have to match whats in the WSDL.   If you are using the
> WSDL URL, could you send me that?    The url on amazons site is:
> http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.
>wsdl? but that has a namespace of:
> http://webservices.amazon.com/AWSECommerceService/2007-07-16
> so I assume it's new than what you were trying to use.
>
>
> 2) Can you also send me the values you are using for:
>
>         URL endpointAddress = binding.getEndpointAddress();
>         String queryStringPostFix = callParams.getUrlPostFix();
>         callParams.getVerb().getVerbName()
>         callParams.getPayload()
>
> Thanks!
> Dan
>
> On Wednesday 22 August 2007, Mark Edwards wrote:
> > Hi
> >
> >
> >
> > I'm getting the following exception when trying to call one of
> > Amazon's REST webservices using the JAX-WS Dispatch approach.
> >
> >
> >
> >
> >
> > 22-Aug-2007 15:52:18
> > org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> > buildServiceFromClass
> >
> > INFO: Creating Service
> > {http://webservices.amazon.com/AWSECommerceService/2005-10-05}amazon
> >_s ervice from class org.apache.cxf.jaxws.support.DummyImpl
> >
> > Exception in thread "main" java.lang.NullPointerException
> >
> >             at
> > org.apache.cxf.jaxws.ServiceImpl.createEndpointInfo(ServiceImpl.java
> >:3 58)
> >
> >             at
> > org.apache.cxf.jaxws.ServiceImpl.getJaxwsEndpoint(ServiceImpl.java:1
> >37 )
> >
> >             at
> > org.apache.cxf.jaxws.ServiceImpl.createDispatch(ServiceImpl.java:188
> >)
> >
> >             at javax.xml.ws.Service.createDispatch(Service.java:166)
> >
> >             at
> > uk.co.orchardsystems.webservices.client.call.DispatchServiceCall.res
> >fF ulCall( DispatchServiceCall.java:98)
> >
> >             at
> > uk.co.orchardsystems.webservices.client.test.AmazonRestFulClient.mai
> >n( AmazonR estFulClient.java:51)
> >
> >
> >
> >
> >
> > My code works fine if I remove CXF from the classpath and run it
> > using the JAX-WS implementation that comes with Java 6.
> >
> >
> >
> >
> >
> > The main calling method in my code is -
> >
> >
> >
> > public Document resfFulCall(RestFulCallParams callParams)
> >
> >             throws WebserviceClientCallException {
> >
> >         BindingDefinition binding =
> > getServiceCallRequest().getBinding();
> >
> >         QName portName = binding.getPortName();
> >
> >         URL endpointAddress = binding.getEndpointAddress();
> >
> >         String fullURL = null;
> >
> >         String queryStringPostFix = callParams.getUrlPostFix();
> >
> >         if (queryStringPostFix != null) {
> >
> >             fullURL = endpointAddress.toString() +
> > queryStringPostFix;
> >
> >         } else {
> >
> >             fullURL = endpointAddress.toString();
> >
> >         }
> >
> >
> >
> >         Service service = getService();
> >
> >         service.addPort(portName, HTTPBinding.HTTP_BINDING,
> > fullURL);
> >
> >         Dispatch<Source> dispatch = service.createDispatch(portName,
> > Source.class, Service.Mode.PAYLOAD);
> >
> >         Map<String, Object> requestContext =
> > dispatch.getRequestContext();
> >
> >         requestContext.put(MessageContext.HTTP_REQUEST_METHOD,
> > callParams.getVerb().getVerbName());
> >
> >         return payLoadInvoke(dispatch, callParams.getPayload());
> >
> > }
> >
> >
> >
> > Supporting methods -
> >
> >
> >
> > protected Service getService() {
> >
> >         ServiceDefinition serviceDefinition =
> > serviceCallRequest.getBinding().getService();
> >
> >         QName serviceName = serviceDefinition.getServiceName();
> >
> >         URL wsdlURL = serviceDefinition.getWsdlURL();
> >
> >         Service service;
> >
> >         if (wsdlURL == null) {
> >
> >             service = Service.create(serviceName);
> >
> >         } else {
> >
> >             service = Service.create(wsdlURL, serviceName);
> >
> >         }
> >
> >
> >
> >         service.setHandlerResolver(new
> > ClientHandlerResolver(serviceCallRequest));
> >
> >
> >
> >         return service;
> >
> > }
> >
> >
> >
> > private Document payLoadInvoke(Dispatch<Source> dispatch, Document
> > payload)
> >
> >             throws WebserviceClientCallException {
> >
> >         DOMSource request = new DOMSource(payload);
> >
> >
> >
> >         Source response = null;
> >
> >         try {
> >
> >             response = dispatch.invoke(request);
> >
> >         } catch (Throwable t) {
> >
> >             processException(t);
> >
> >         }
> >
> >
> >
> >         try {
> >
> >             return XMLUtils.domSourceToDocument(response);
> >
> >         } catch (TransformerConfigurationException e) {
> >
> >             throw new WebserviceClientCallException(e);
> >
> >         } catch (TransformerFactoryConfigurationError e) {
> >
> >             throw new WebserviceClientCallException(e);
> >
> >         } catch (TransformerException e) {
> >
> >             throw new WebserviceClientCallException(e);
> >
> >         }
> >
> > }
> >
> >
> >
> > Relevant values -
> >
> >
> >
> > Service name = new
> > QName("http://webservices.amazon.com/AWSECommerceService/2005-10-05"
> >, "amazon_service")
> >
> > Port name = new
> > QName("http://webservices.amazon.com/AWSECommerceService/2005-10-05"
> >, "amazon_port")
> >
> > (I wasn't completely sure what to set these to for a RESTful call
> > but they seem to work when not using CXF)
> >
> >
> >
> > endPointAddress =
> > http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAcc
> >es sKeyId= [will
> > <http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAc
> >ce ssKeyId =%5bwill>  need to add a valid access ID here if you want
> > to use this
> > URL]&Operation=ItemSearch&SearchIndex=Books&Title=Harry%20Potter
> >
> >
> >
> > queryStringPostFix = null
> >
> >
> >
> >
> >
> >
> >
> > I'm running the 2.0 version of CXF.
> >
> >
> >
> >
> >
> >
> >
> > The problem appears to be in the following bit of code -
> >
> >
> >
> > private EndpointInfo createEndpointInfo(AbstractServiceFactoryBean
> > serviceFactory,
> >
> >                                             QName portName,
> >
> >                                             PortInfoImpl portInfo)
> > throws BusException {
> >
> >         EndpointInfo ei = null;
> >
> >         String address = portInfo.getAddress();
> >
> >
> >
> >         DestinationFactoryManager dfm =
> > bus.getExtension(DestinationFactoryManager.class);
> >
> >         DestinationFactory df =
> > dfm.getDestinationFactoryForUri(portInfo.getAddress());
> >
> >
> >
> >         String transportId = df.getTransportIds().get(0);
> >
> >         String bindingID =
> > BindingID.getBindingID(portInfo.getBindingID());
> >
> >
> >
> >         Object config = null;
> >
> >         if (serviceFactory instanceof JaxWsServiceFactoryBean) {
> >
> >             config = new
> > JaxWsSoapBindingConfiguration((JaxWsServiceFactoryBean)serviceFactor
> >y) ;
> >
> >         }
> >
> >         BindingInfo bindingInfo =
> > bus.getExtension(BindingFactoryManager.class).getBindingFactory(bind
> >in gID)
> >
> >                 .createBindingInfo(serviceFactory.getService(),
> > bindingID, config);
> >
> >
> >
> >
> >
> >         Service service = serviceFactory.getService();
> >
> >         service.getServiceInfos().get(0).addBinding(bindingInfo);
> >
> >
> >
> >         ei = new EndpointInfo(service.getServiceInfos().get(0),
> > transportId);
> >
> >         ei.setName(portName);
> >
> >         ei.setAddress(address);
> >
> >         ei.setBinding(bindingInfo);
> >
> >
> >
> >         service.getServiceInfos().get(0).addEndpoint(ei);
> >
> >         return ei;
> >
> >     }
> >
> >
> >
> > The DestinationFactory df is null because the
> > DestinationFactoryManger instance has an empty Map of
> > destinationFactories.  But maybe it shouldn't have got to this point
> > in the first place and the problem is really in ServiceImpl.
> > getJaxwsEndpoint.
> >
> >
> >
> > I hope this is enough information to look into the problem and see
> > what I've done wrong.
> >
> >
> >
> >
> >
> > Thanks in anticipation.
> >
> >
> >
> > Mark
> >
> >
> >
> >
> >
> > Mark Edwards
> >
> > Orchard Information Systems Limited,
> > Newcastle Technopole, Kings Manor,
> > Newcastle upon Tyne,
> > NE1 6PA
> > United Kingdom.
> > Registered in England, Number 1900078
> > Tel: +44 (0)191-203 2500  Fax: +44 (0)191-230 2515
> > http://www.orchard-systems.co.uk <http://www.orchard-systems.co.uk/>
> >
> >
> >
> >
> > This e-mail and any files transmitted are confidential and is solely
> > for the intended recipient. Unauthorised use, dissemination,
> > distribution, copying, reproduction, modification or publication is
> > strictly prohibited. If you have received this e-mail in error,
> > please notify the sender and permanently delete the e-mail from your
> > system. Opinions expressed in this e-mail are those of the
> > individual and not necessarily those of Orchard Information Systems
> > Ltd.
> >
> > It is the responsibility of the recipient to ensure this e-mail is
> > free from viruses. Orchard Information Systems Ltd accept no
> > liability for any damage caused by any virus transmitted by this
> > e-mail.
> >
> > Incoming and outgoing e-mail messages are routinely monitored for
> > compliance with Orchard Information Systems Ltd's Internet Usage
> > Policy.
> >
> > Orchard Information Systems Ltd. Registered in England No. 1900078
> > Newcastle Technopole, Kings Manor, Newcastle upon Tyne, NE1 6PA
> >
> > Please consider the environment before printing this e-mail.



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

RE: NullPointerException with REST client call using JAX-WS Dispatch

Posted by Mark Edwards <ma...@orchard-systems.co.uk>.
Hi Dan

Thanks for the reply.  The answers to your questions are - 

1) The WSDL URL is null.  

I have subsequently tried to call some RPC encoded webservices using Dispatch
and creating the Service without a WSDL and this gets the same error under
CXF but works with the RI.  So, as you have probably already realised, the
lack of a WSDL looks like an important part of the problem.

2) URL endpointAddress =
http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=
[will need to add a valid access ID here if you want to use this
URL]&Operation=ItemSearch&SearchIndex=Books&Title=Harry%20Potter

I can provide my Access Key if you need to use the above URL.

String queryStringPostFix = null;

callParams.getVerb().getVerbName() = "POST";

callParams.getPayload() = null;


Best Regards

Mark



-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org] 
Sent: 24 August 2007 18:01
To: cxf-user@incubator.apache.org
Cc: Mark Edwards
Subject: Re: NullPointerException with REST client call using JAX-WS Dispatch


Mark,

I think I need some more details:

1) Are you using a WSDL URL or not for the call at:
 if (wsdlURL == null) {
          service = Service.create(serviceName);
 } else {
          service = Service.create(wsdlURL, serviceName);
 }
That's important.   If you ARE using a WSDL URL, the serviceName and 
portnames will have to match whats in the WSDL.   If you are using the 
WSDL URL, could you send me that?    The url on amazons site is:
http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl?
but that has a namespace of: 
http://webservices.amazon.com/AWSECommerceService/2007-07-16
so I assume it's new than what you were trying to use.


2) Can you also send me the values you are using for:

        URL endpointAddress = binding.getEndpointAddress();
        String queryStringPostFix = callParams.getUrlPostFix();
        callParams.getVerb().getVerbName()
        callParams.getPayload()

Thanks!
Dan




On Wednesday 22 August 2007, Mark Edwards wrote:
> Hi
>
>
>
> I'm getting the following exception when trying to call one of
> Amazon's REST webservices using the JAX-WS Dispatch approach.
>
>
>
>
>
> 22-Aug-2007 15:52:18
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> buildServiceFromClass
>
> INFO: Creating Service
> {http://webservices.amazon.com/AWSECommerceService/2005-10-05}amazon_s
>ervice from class org.apache.cxf.jaxws.support.DummyImpl
>
> Exception in thread "main" java.lang.NullPointerException
>
>             at
> org.apache.cxf.jaxws.ServiceImpl.createEndpointInfo(ServiceImpl.java:3
>58)
>
>             at
> org.apache.cxf.jaxws.ServiceImpl.getJaxwsEndpoint(ServiceImpl.java:137
>)
>
>             at
> org.apache.cxf.jaxws.ServiceImpl.createDispatch(ServiceImpl.java:188)
>
>             at javax.xml.ws.Service.createDispatch(Service.java:166)
>
>             at
> uk.co.orchardsystems.webservices.client.call.DispatchServiceCall.resfF
>ulCall( DispatchServiceCall.java:98)
>
>             at
> uk.co.orchardsystems.webservices.client.test.AmazonRestFulClient.main(
>AmazonR estFulClient.java:51)
>
>
>
>
>
> My code works fine if I remove CXF from the classpath and run it using
> the JAX-WS implementation that comes with Java 6.
>
>
>
>
>
> The main calling method in my code is -
>
>
>
> public Document resfFulCall(RestFulCallParams callParams)
>
>             throws WebserviceClientCallException {
>
>         BindingDefinition binding =
> getServiceCallRequest().getBinding();
>
>         QName portName = binding.getPortName();
>
>         URL endpointAddress = binding.getEndpointAddress();
>
>         String fullURL = null;
>
>         String queryStringPostFix = callParams.getUrlPostFix();
>
>         if (queryStringPostFix != null) {
>
>             fullURL = endpointAddress.toString() + queryStringPostFix;
>
>         } else {
>
>             fullURL = endpointAddress.toString();
>
>         }
>
>
>
>         Service service = getService();
>
>         service.addPort(portName, HTTPBinding.HTTP_BINDING, fullURL);
>
>         Dispatch<Source> dispatch = service.createDispatch(portName,
> Source.class, Service.Mode.PAYLOAD);
>
>         Map<String, Object> requestContext =
> dispatch.getRequestContext();
>
>         requestContext.put(MessageContext.HTTP_REQUEST_METHOD,
> callParams.getVerb().getVerbName());
>
>         return payLoadInvoke(dispatch, callParams.getPayload());
>
> }
>
>
>
> Supporting methods -
>
>
>
> protected Service getService() {
>
>         ServiceDefinition serviceDefinition =
> serviceCallRequest.getBinding().getService();
>
>         QName serviceName = serviceDefinition.getServiceName();
>
>         URL wsdlURL = serviceDefinition.getWsdlURL();
>
>         Service service;
>
>         if (wsdlURL == null) {
>
>             service = Service.create(serviceName);
>
>         } else {
>
>             service = Service.create(wsdlURL, serviceName);
>
>         }
>
>
>
>         service.setHandlerResolver(new
> ClientHandlerResolver(serviceCallRequest));
>
>
>
>         return service;
>
> }
>
>
>
> private Document payLoadInvoke(Dispatch<Source> dispatch, Document
> payload)
>
>             throws WebserviceClientCallException {
>
>         DOMSource request = new DOMSource(payload);
>
>
>
>         Source response = null;
>
>         try {
>
>             response = dispatch.invoke(request);
>
>         } catch (Throwable t) {
>
>             processException(t);
>
>         }
>
>
>
>         try {
>
>             return XMLUtils.domSourceToDocument(response);
>
>         } catch (TransformerConfigurationException e) {
>
>             throw new WebserviceClientCallException(e);
>
>         } catch (TransformerFactoryConfigurationError e) {
>
>             throw new WebserviceClientCallException(e);
>
>         } catch (TransformerException e) {
>
>             throw new WebserviceClientCallException(e);
>
>         }
>
> }
>
>
>
> Relevant values -
>
>
>
> Service name = new
> QName("http://webservices.amazon.com/AWSECommerceService/2005-10-05",
> "amazon_service")
>
> Port name = new
> QName("http://webservices.amazon.com/AWSECommerceService/2005-10-05",
> "amazon_port")
>
> (I wasn't completely sure what to set these to for a RESTful call but
> they seem to work when not using CXF)
>
>
>
> endPointAddress =
> http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAcces
>sKeyId= [will
> <http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAcce
>ssKeyId =%5bwill>  need to add a valid access ID here if you want to
> use this
> URL]&Operation=ItemSearch&SearchIndex=Books&Title=Harry%20Potter
>
>
>
> queryStringPostFix = null
>
>
>
>
>
>
>
> I'm running the 2.0 version of CXF.
>
>
>
>
>
>
>
> The problem appears to be in the following bit of code -
>
>
>
> private EndpointInfo createEndpointInfo(AbstractServiceFactoryBean
> serviceFactory,
>
>                                             QName portName,
>
>                                             PortInfoImpl portInfo)
> throws BusException {
>
>         EndpointInfo ei = null;
>
>         String address = portInfo.getAddress();
>
>
>
>         DestinationFactoryManager dfm =
> bus.getExtension(DestinationFactoryManager.class);
>
>         DestinationFactory df =
> dfm.getDestinationFactoryForUri(portInfo.getAddress());
>
>
>
>         String transportId = df.getTransportIds().get(0);
>
>         String bindingID =
> BindingID.getBindingID(portInfo.getBindingID());
>
>
>
>         Object config = null;
>
>         if (serviceFactory instanceof JaxWsServiceFactoryBean) {
>
>             config = new
> JaxWsSoapBindingConfiguration((JaxWsServiceFactoryBean)serviceFactory)
>;
>
>         }
>
>         BindingInfo bindingInfo =
> bus.getExtension(BindingFactoryManager.class).getBindingFactory(bindin
>gID)
>
>                 .createBindingInfo(serviceFactory.getService(),
> bindingID, config);
>
>
>
>
>
>         Service service = serviceFactory.getService();
>
>         service.getServiceInfos().get(0).addBinding(bindingInfo);
>
>
>
>         ei = new EndpointInfo(service.getServiceInfos().get(0),
> transportId);
>
>         ei.setName(portName);
>
>         ei.setAddress(address);
>
>         ei.setBinding(bindingInfo);
>
>
>
>         service.getServiceInfos().get(0).addEndpoint(ei);
>
>         return ei;
>
>     }
>
>
>
> The DestinationFactory df is null because the DestinationFactoryManger
> instance has an empty Map of destinationFactories.  But maybe it
> shouldn't have got to this point in the first place and the problem is
> really in ServiceImpl. getJaxwsEndpoint.
>
>
>
> I hope this is enough information to look into the problem and see
> what I've done wrong.
>
>
>
>
>
> Thanks in anticipation.
>
>
>
> Mark
>
>
>
>
>
> Mark Edwards
>
> Orchard Information Systems Limited,
> Newcastle Technopole, Kings Manor,
> Newcastle upon Tyne,
> NE1 6PA
> United Kingdom.
> Registered in England, Number 1900078
> Tel: +44 (0)191-203 2500  Fax: +44 (0)191-230 2515
> http://www.orchard-systems.co.uk <http://www.orchard-systems.co.uk/>
>
>
>
>
> This e-mail and any files transmitted are confidential and is solely
> for the intended recipient. Unauthorised use, dissemination,
> distribution, copying, reproduction, modification or publication is
> strictly prohibited. If you have received this e-mail in error, please
> notify the sender and permanently delete the e-mail from your system.
> Opinions expressed in this e-mail are those of the individual and not
> necessarily those of Orchard Information Systems Ltd.
>
> It is the responsibility of the recipient to ensure this e-mail is
> free from viruses. Orchard Information Systems Ltd accept no liability
> for any damage caused by any virus transmitted by this e-mail.
>
> Incoming and outgoing e-mail messages are routinely monitored for
> compliance with Orchard Information Systems Ltd's Internet Usage
> Policy.
>
> Orchard Information Systems Ltd. Registered in England No. 1900078
> Newcastle Technopole, Kings Manor, Newcastle upon Tyne, NE1 6PA
>
> Please consider the environment before printing this e-mail.



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: NullPointerException with REST client call using JAX-WS Dispatch

Posted by Daniel Kulp <dk...@apache.org>.
Mark,

I think I need some more details:

1) Are you using a WSDL URL or not for the call at:
 if (wsdlURL == null) {
          service = Service.create(serviceName);
 } else {
          service = Service.create(wsdlURL, serviceName);
 }
That's important.   If you ARE using a WSDL URL, the serviceName and 
portnames will have to match whats in the WSDL.   If you are using the 
WSDL URL, could you send me that?    The url on amazons site is:
http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl?
but that has a namespace of: 
http://webservices.amazon.com/AWSECommerceService/2007-07-16
so I assume it's new than what you were trying to use.


2) Can you also send me the values you are using for:

        URL endpointAddress = binding.getEndpointAddress();
        String queryStringPostFix = callParams.getUrlPostFix();
        callParams.getVerb().getVerbName()
        callParams.getPayload()

Thanks!
Dan




On Wednesday 22 August 2007, Mark Edwards wrote:
> Hi
>
>
>
> I'm getting the following exception when trying to call one of
> Amazon's REST webservices using the JAX-WS Dispatch approach.
>
>
>
>
>
> 22-Aug-2007 15:52:18
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> buildServiceFromClass
>
> INFO: Creating Service
> {http://webservices.amazon.com/AWSECommerceService/2005-10-05}amazon_s
>ervice from class org.apache.cxf.jaxws.support.DummyImpl
>
> Exception in thread "main" java.lang.NullPointerException
>
>             at
> org.apache.cxf.jaxws.ServiceImpl.createEndpointInfo(ServiceImpl.java:3
>58)
>
>             at
> org.apache.cxf.jaxws.ServiceImpl.getJaxwsEndpoint(ServiceImpl.java:137
>)
>
>             at
> org.apache.cxf.jaxws.ServiceImpl.createDispatch(ServiceImpl.java:188)
>
>             at javax.xml.ws.Service.createDispatch(Service.java:166)
>
>             at
> uk.co.orchardsystems.webservices.client.call.DispatchServiceCall.resfF
>ulCall( DispatchServiceCall.java:98)
>
>             at
> uk.co.orchardsystems.webservices.client.test.AmazonRestFulClient.main(
>AmazonR estFulClient.java:51)
>
>
>
>
>
> My code works fine if I remove CXF from the classpath and run it using
> the JAX-WS implementation that comes with Java 6.
>
>
>
>
>
> The main calling method in my code is -
>
>
>
> public Document resfFulCall(RestFulCallParams callParams)
>
>             throws WebserviceClientCallException {
>
>         BindingDefinition binding =
> getServiceCallRequest().getBinding();
>
>         QName portName = binding.getPortName();
>
>         URL endpointAddress = binding.getEndpointAddress();
>
>         String fullURL = null;
>
>         String queryStringPostFix = callParams.getUrlPostFix();
>
>         if (queryStringPostFix != null) {
>
>             fullURL = endpointAddress.toString() + queryStringPostFix;
>
>         } else {
>
>             fullURL = endpointAddress.toString();
>
>         }
>
>
>
>         Service service = getService();
>
>         service.addPort(portName, HTTPBinding.HTTP_BINDING, fullURL);
>
>         Dispatch<Source> dispatch = service.createDispatch(portName,
> Source.class, Service.Mode.PAYLOAD);
>
>         Map<String, Object> requestContext =
> dispatch.getRequestContext();
>
>         requestContext.put(MessageContext.HTTP_REQUEST_METHOD,
> callParams.getVerb().getVerbName());
>
>         return payLoadInvoke(dispatch, callParams.getPayload());
>
> }
>
>
>
> Supporting methods -
>
>
>
> protected Service getService() {
>
>         ServiceDefinition serviceDefinition =
> serviceCallRequest.getBinding().getService();
>
>         QName serviceName = serviceDefinition.getServiceName();
>
>         URL wsdlURL = serviceDefinition.getWsdlURL();
>
>         Service service;
>
>         if (wsdlURL == null) {
>
>             service = Service.create(serviceName);
>
>         } else {
>
>             service = Service.create(wsdlURL, serviceName);
>
>         }
>
>
>
>         service.setHandlerResolver(new
> ClientHandlerResolver(serviceCallRequest));
>
>
>
>         return service;
>
> }
>
>
>
> private Document payLoadInvoke(Dispatch<Source> dispatch, Document
> payload)
>
>             throws WebserviceClientCallException {
>
>         DOMSource request = new DOMSource(payload);
>
>
>
>         Source response = null;
>
>         try {
>
>             response = dispatch.invoke(request);
>
>         } catch (Throwable t) {
>
>             processException(t);
>
>         }
>
>
>
>         try {
>
>             return XMLUtils.domSourceToDocument(response);
>
>         } catch (TransformerConfigurationException e) {
>
>             throw new WebserviceClientCallException(e);
>
>         } catch (TransformerFactoryConfigurationError e) {
>
>             throw new WebserviceClientCallException(e);
>
>         } catch (TransformerException e) {
>
>             throw new WebserviceClientCallException(e);
>
>         }
>
> }
>
>
>
> Relevant values -
>
>
>
> Service name = new
> QName("http://webservices.amazon.com/AWSECommerceService/2005-10-05",
> "amazon_service")
>
> Port name = new
> QName("http://webservices.amazon.com/AWSECommerceService/2005-10-05",
> "amazon_port")
>
> (I wasn't completely sure what to set these to for a RESTful call but
> they seem to work when not using CXF)
>
>
>
> endPointAddress =
> http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAcces
>sKeyId= [will
> <http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAcce
>ssKeyId =%5bwill>  need to add a valid access ID here if you want to
> use this
> URL]&Operation=ItemSearch&SearchIndex=Books&Title=Harry%20Potter
>
>
>
> queryStringPostFix = null
>
>
>
>
>
>
>
> I'm running the 2.0 version of CXF.
>
>
>
>
>
>
>
> The problem appears to be in the following bit of code -
>
>
>
> private EndpointInfo createEndpointInfo(AbstractServiceFactoryBean
> serviceFactory,
>
>                                             QName portName,
>
>                                             PortInfoImpl portInfo)
> throws BusException {
>
>         EndpointInfo ei = null;
>
>         String address = portInfo.getAddress();
>
>
>
>         DestinationFactoryManager dfm =
> bus.getExtension(DestinationFactoryManager.class);
>
>         DestinationFactory df =
> dfm.getDestinationFactoryForUri(portInfo.getAddress());
>
>
>
>         String transportId = df.getTransportIds().get(0);
>
>         String bindingID =
> BindingID.getBindingID(portInfo.getBindingID());
>
>
>
>         Object config = null;
>
>         if (serviceFactory instanceof JaxWsServiceFactoryBean) {
>
>             config = new
> JaxWsSoapBindingConfiguration((JaxWsServiceFactoryBean)serviceFactory)
>;
>
>         }
>
>         BindingInfo bindingInfo =
> bus.getExtension(BindingFactoryManager.class).getBindingFactory(bindin
>gID)
>
>                 .createBindingInfo(serviceFactory.getService(),
> bindingID, config);
>
>
>
>
>
>         Service service = serviceFactory.getService();
>
>         service.getServiceInfos().get(0).addBinding(bindingInfo);
>
>
>
>         ei = new EndpointInfo(service.getServiceInfos().get(0),
> transportId);
>
>         ei.setName(portName);
>
>         ei.setAddress(address);
>
>         ei.setBinding(bindingInfo);
>
>
>
>         service.getServiceInfos().get(0).addEndpoint(ei);
>
>         return ei;
>
>     }
>
>
>
> The DestinationFactory df is null because the DestinationFactoryManger
> instance has an empty Map of destinationFactories.  But maybe it
> shouldn't have got to this point in the first place and the problem is
> really in ServiceImpl. getJaxwsEndpoint.
>
>
>
> I hope this is enough information to look into the problem and see
> what I've done wrong.
>
>
>
>
>
> Thanks in anticipation.
>
>
>
> Mark
>
>
>
>
>
> Mark Edwards
>
> Orchard Information Systems Limited,
> Newcastle Technopole, Kings Manor,
> Newcastle upon Tyne,
> NE1 6PA
> United Kingdom.
> Registered in England, Number 1900078
> Tel: +44 (0)191-203 2500  Fax: +44 (0)191-230 2515
> http://www.orchard-systems.co.uk <http://www.orchard-systems.co.uk/>
>
>
>
>
> This e-mail and any files transmitted are confidential and is solely
> for the intended recipient. Unauthorised use, dissemination,
> distribution, copying, reproduction, modification or publication is
> strictly prohibited. If you have received this e-mail in error, please
> notify the sender and permanently delete the e-mail from your system.
> Opinions expressed in this e-mail are those of the individual and not
> necessarily those of Orchard Information Systems Ltd.
>
> It is the responsibility of the recipient to ensure this e-mail is
> free from viruses. Orchard Information Systems Ltd accept no liability
> for any damage caused by any virus transmitted by this e-mail.
>
> Incoming and outgoing e-mail messages are routinely monitored for
> compliance with Orchard Information Systems Ltd's Internet Usage
> Policy.
>
> Orchard Information Systems Ltd. Registered in England No. 1900078
> Newcastle Technopole, Kings Manor, Newcastle upon Tyne, NE1 6PA
>
> Please consider the environment before printing this e-mail.



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog