Umm... With that stack trace, you are picking up the Sun reference
implementation, not CXF. Double check to make sure CXF is properly packaged
and deployed.
Dan
On Tue September 15 2009 10:10:59 am Jacob Bergöö wrote:
> Hi,
> we have a problem when we are trying to implement our first service client
> using Apache CFX (version 2.2.3).
>
> We have generated our code from a wsdl file by using the wsdl2java
> functionality and that is working fine. We then tried our code by creating
> a main method calling our service-client (in Eclipse) and we are using
> soapUI to mock the response. This is all working fine also, but now to the
> problem. When we have packed our application and deployed it on our
> weblogic server (10.3) then we get this error when the service is called:
>
> java.lang.NullPointerException
> at
> com.sun.xml.ws.client.WSServiceDelegate.getPortModel(WSServiceDelegate.java
> :632) at
> com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:312)
> at
> com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:306)
> at javax.xml.ws.Service.getPort(Service.java:92)
> ....
>
> Our java code looks like this:
>
> @Override
> public Statistics getStatistics(final String ip, final int timeout)
> throws
> IllegalArgumentException {
>
> if (ip == null) {
> throw new IllegalArgumentException(
> "Can not contact webservice with ip address == null.");
> }
> String endpointAddress = "http://" + ip + ":80" +
> WEBSERICE_PATH;
> final Service service = Service.create(SERVICE_NAME);
> service.addPort(SERVICE_NAME, SOAPBinding.SOAP12HTTP_BINDING,
> endpointAddress);
> ServicePortType port = service.getPort(SERVICE_NAME,
> ServicePortType.class);
> setClientTimeoutPolicy(port, timeout);
>
> StatisticsResponse bs = port.getStatistics();
> return convert(bs);
> }
>
> /**
> * Adds HTTP client policy
> */
> private void setClientTimeoutPolicy(ServicePortType port, int timeout) {
> Client client = ClientProxy.getClient(port);
> HTTPConduit http = (HTTPConduit) client.getConduit();
>
> HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
> httpClientPolicy.setConnectionTimeout(timeout);
> httpClientPolicy.setReceiveTimeout(timeout);
>
> http.setClient(httpClientPolicy);
> }
>
>
> we are using java 1.6.0_05-b13 and in our pom.xml we have added the
> following dependencies:
>
> <dependency>
> <groupId>com.sun.xml.bind</groupId>
> <artifactId>jaxb-xjc</artifactId>
> <version>2.1.12</version>
> </dependency>
> <dependency>
> <groupId>com.sun.xml.bind</groupId>
> <artifactId>jaxb-impl</artifactId>
> <version>2.1.12</version>
> </dependency>
> <dependency>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-rt-frontend-jaxws</artifactId>
> <version>2.2.3</version>
> </dependency>
> <dependency>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-rt-transports-http</artifactId>
> <version>2.2.3</version>
> </dependency>
> <dependency>
> <groupId>org.apache.geronimo.specs</groupId>
> <artifactId>geronimo-annotation_1.0_spec</artifactId>
> <version>1.1</version>
> </dependency>
>
> We have tried to searched the forum and also searched on google but we
> haven't found anything that can help us to solve our problem.
>
>
> Thanks in advance,
> Jacob
>
--
Daniel Kulp
[email protected]
http://www.dankulp.com/blog