Return-Path: Delivered-To: apmail-incubator-cxf-dev-archive@locus.apache.org Received: (qmail 17472 invoked from network); 7 Dec 2006 04:49:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Dec 2006 04:49:24 -0000 Received: (qmail 51720 invoked by uid 500); 7 Dec 2006 04:49:32 -0000 Delivered-To: apmail-incubator-cxf-dev-archive@incubator.apache.org Received: (qmail 51673 invoked by uid 500); 7 Dec 2006 04:49:32 -0000 Mailing-List: contact cxf-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-dev@incubator.apache.org Received: (qmail 51664 invoked by uid 99); 7 Dec 2006 04:49:32 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Dec 2006 20:49:32 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of Eric.Johnson@iona.com designates 65.223.216.181 as permitted sender) Received: from [65.223.216.181] (HELO amereast-smg1.iona.com) (65.223.216.181) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Dec 2006 20:49:21 -0800 Received: from amer-ems1.IONAGLOBAL.COM ([10.65.6.25]) by amereast-smg1.iona.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id kB74md75019508 for ; Wed, 6 Dec 2006 23:48:39 -0500 (EST) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: FW: Java first question Date: Wed, 6 Dec 2006 23:48:01 -0500 Message-ID: <8DA58330BA060E41AB52B73294034EA6258669@amer-ems1.IONAGLOBAL.COM> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: FW: Java first question Thread-Index: AccZuWi0/tKbmrZNSO6XNiGBxTs9owAAVy5w From: "Johnson, Eric" To: X-Virus-Checked: Checked by ClamAV on apache.org Willem, Thanks for the help. I'll give it a go in the morning!! Cheers, Eric=20 > -----Original Message----- > From: Willem Jiang [mailto:ning.jiang@iona.com]=20 > Sent: Wednesday, December 06, 2006 11:34 PM > To: cxf-dev@incubator.apache.org > Subject: Re: FW: Java first question >=20 > Hi Eric, >=20 > I think your client side code need to be changed to get the=20 > connect to the server. > Here are two ways to create client. >=20 > 1. Code first , as you know , when you use code first to=20 > create webservice, you need to specify the endpoint address=20 > or the ServerFactoryBean will build an default address for you. > That means from the Java code we can't get the address=20 > to build up the endpoint information. > So when you use > Service s =3D Service.create(serviceName); > to create endpoint info, you can use addport to specify=20 > the detail binding and address info. > service.addPort(portName, "http://schemas.xmlsoap.org/soap/", > "http://localhost:9000/SoapContext/SoapPort"); > quoteReporter proxy =3D s.getPort(portName, quoteReporter.class); > The example you can find from > org.apache.cxf.systest.jaxws.ClientServerTest's testAddPort. >=20 > 2. WSDL first, if you alread get the wsdl file, you just can use > Service s =3D Service.create(wsdlURL, servcieName); > QName portName =3D new QName("http://demo.eric.org",=20 > "stockQuoteReporterPort"); > quoteReporter proxy =3D s.getPort(portName); >=20 > Thanks, >=20 > Willem. >=20 > Johnson, Eric wrote: >=20 > > =20 > > > >>-----Original Message----- > >>From: Johnson, Eric [mailto:Eric.Johnson@iona.com] > >>Sent: Wednesday, December 06, 2006 1:20 PM > >>To: cxf-dev@incubator.apache.org > >>Subject: RE: FW: Java first question > >> > >>I got the server running and now I created the following=20 > client code=20 > >>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 =3D new QName("http://demo.eric.org",=20 > >>"stockQuoteReporter"); > >> Service s =3D Service.create(serviceName); > >> System.out.println("Service "+serviceName+" created..."); > >> quoteReporter proxy =3D s.getPort(quoteReporter.class); > >> System.out.println("Proxy created..."); > >> Quote quote =3D proxy.getQuote("ALPHA"); > >> System.out.println("Stock "+quote.getID()+" is worth=20 > >>"+quote.getVal()+" as of "+quote.getTime()); > >> } > >>} > >> > >>The SEI is as follows: > >>package org.eric.demo; > >> > >>import javax.jws.*; > >> > >>@WebService(name=3D"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"=20 > >>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? > >>=20 > >> > >> =20 > >> >=20 >=20