I tried to use the create method that specifies the port name to get
around the unable to find port name exception and got the following
exception:
[java] Service {http://demo.eric.org}stockQuoteReporter created...
[java] Exception in thread "main" java.lang.NullPointerException:
EndpointInfo can not be null!
[java] at
org.apache.cxf.endpoint.EndpointImpl.<init>(EndpointImpl.java:66)
[java] at
org.apache.cxf.jaxws.support.JaxWsEndpointImpl.<init>(JaxWsEndpointImpl.
java:56)
[java] at
org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:272)
[java] at
org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:200)
[java] at javax.xml.ws.Service.getPort(Service.java:94)
[java] at org.eric.demo.Client.main(Client.java:16)
The portName I passed in was
{http://demo.eric.org}stockQuoteReporterPort.
The WSDL returned from the server is:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="stockQuoteReporter"
targetNamespace="http://demo.eric.org"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:ns1="http://demo.eric.org"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
<xs:complexType name="quote">
<xs:sequence>
<xs:element minOccurs="0" name="ID" type="xs:string"/>
<xs:element minOccurs="0" name="time" type="xs:string"/>
<xs:element name="val" type="xs:float"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://demo.eric.org" attributeFormDefault="unqualified"
elementFormDefault="qualified" targetNamespace="http://demo.eric.org">
<xsd:element name="getQuote">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="arg00" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getQuoteResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="return" type="quote"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="getQuote">
<wsdl:part name="getQuote" element="ns1:getQuote">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getQuoteResponse">
<wsdl:part name="getQuoteResponse" element="ns1:getQuoteResponse">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="stockQuoteReporterPortType">
<wsdl:operation name="getQuote">
<wsdl:input name="getQuote" message="ns1:getQuote">
</wsdl:input>
<wsdl:output name="getQuoteResponse"
message="ns1:getQuoteResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="stockQuoteReporterSoapBinding"
type="ns1:stockQuoteReporterPortType">
<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getQuote">
<wsdlsoap:operation soapAction="" style="document"/>
<wsdl:input name="getQuote">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getQuoteResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="stockQuoteReporter">
<wsdl:port name="stockQuoteReporterPort"
binding="ns1:stockQuoteReporterSoapBinding">
<wsdlsoap:address
location="http://localhost:9000/EricStockQuote"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Is there something I'm not doing correctly?
> -----Original Message-----
> From: Johnson, Eric [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 06, 2006 1:20 PM
> To: [email protected]
> Subject: RE: FW: Java first question
>
> I got the server running and now I created the following
> client code to connect to it:
> package org.eric.demo;
>
> import java.io.File;
> import java.net.URL;
> import javax.xml.namespace.QName;
> import javax.xml.ws.Service;
>
> public class Client
> {
> public static void main(String args[])
> {
> QName serviceName = new QName("http://demo.eric.org",
> "stockQuoteReporter");
> Service s = Service.create(serviceName);
> System.out.println("Service "+serviceName+" created...");
> quoteReporter proxy = s.getPort(quoteReporter.class);
> System.out.println("Proxy created...");
> Quote quote = proxy.getQuote("ALPHA");
> System.out.println("Stock "+quote.getID()+" is worth
> "+quote.getVal()+" as of "+quote.getTime());
> }
> }
>
> The SEI is as follows:
> package org.eric.demo;
>
> import javax.jws.*;
>
> @WebService(name="quoteReporter")
> public interface quoteReporter
> {
> public Quote getQuote(String ticker);
> }
>
> When I run the client I get the following:
> client:
> [java] Service {http://demo.eric.org}stockQuoteReporter
> created...
> [java] Exception in thread "main"
> javax.xml.ws.WebServiceException:
> Unable to determine port name.
> [java] at
> org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:267)
> [java] at
> org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:193)
> [java] at javax.xml.ws.Service.getPort(Service.java:120)
> [java] at org.eric.demo.Client.main(Client.java:15)
>
> What do I need to do to get the client to connect?
>
>
> > -----Original Message-----
> > From: Dan Diephouse [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, December 06, 2006 12:12 PM
> > To: [email protected]
> > Subject: Re: FW: Java first question
> >
> > I saw this problem the other day but haven't had the chance
> to fix - I
> > think it occurs when you leave @WebService off your implementation
> > class. If you have an interface & implementation (as
> opposed to just a
> > class), then you need to specify
> @WebService(endpointInterface="...")
> >
> > Hope that helps,
> > - Dan
> >
> > On 12/6/06, Johnson, Eric <[EMAIL PROTECTED]> wrote:
> > >
> > > Using the attached code I get the following exception when
> > running my
> > > server:
> > > [java] Exception in thread "main"
> > java.lang.NullPointerException
> > > [java] at
> > >
> >
> org.apache.cxf.jaxws.support.JaxWsImplementorInfo.getEndpointName(JaxW
> > > sI
> > > mplementorInfo.java:123)
> > > [java] at
> > >
> >
> org.apache.cxf.jaxws.support.JaxWsServiceConfiguration.getEndpointName
> > > (J
> > > axWsServiceConfiguration.java:103)
> > > [java] at
> > >
> >
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.getEndpoin
> > > tN
> > > ame(ReflectionServiceFactoryBean.java:455)
> > > [java] at
> > >
> >
> org.apache.cxf.service.factory.AbstractEndpointFactory.createEndpoint(
> > > Ab
> > > stractEndpointFactory.java:60)
> > > [java] at
> > >
> >
> org.apache.cxf.service.factory.ServerFactoryBean.create(ServerFactoryB
> > > ea
> > > n.java:77)
> > > [java] at
> > > org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:220)
> > > [java] at
> > > org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:155)
> > > [java] at
> > >
> >
> org.apache.cxf.jaxws.spi.ProviderImpl.createAndPublishEndpoint(Provide
> > > rI
> > > mpl.java:67)
> > > [java] at
> javax.xml.ws.Endpoint.publish(Endpoint.java:156)
> > > [java] at org.eric.demo.Server.main(Server.java:12)
> > >
> > > What did I forget to do?
> > >
> > > > -----Original Message-----
> > > > From: Jim Ma [mailto:[EMAIL PROTECTED]
> > > > Sent: Tuesday, December 05, 2006 9:35 PM
> > > > To: [email protected]
> > > > Subject: RE: Java first question
> > > >
> > > > If use RPC_Lit and Doc_Bare , we need add two annotaions to an
> > > > interface:
> > > > @WebService
> > > > @SOAPBinding
> > > >
> > > > If use Doc_Wrapped, we only need to add @WebService annotation .
> > > > Doc_Wrapped is the default style .
> > > >
> > > > Regards
> > > >
> > > > Jim
> > > >
> > > > > -----Original Message-----
> > > > > From: Johnson, Eric [mailto:[EMAIL PROTECTED]
> > > > > Sent: Wednesday, December 06, 2006 6:57 AM
> > > > > To: [email protected]
> > > > > Subject: Java first question
> > > > >
> > > > >
> > > > > What is the minimum amount of annotation I need to add to
> > > > an interface
> > > > > to Web service enable it?
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
> > --
> > Dan Diephouse
> > Envoi Solutions
> > http://envoisolutions.com | http://netzooid.com/blog
> >
>