Nevermind ... i figured it out.
Robert Simmons Jr. wrote:
Greetings. I am trying to build a simple newbie clinet to talk to the
version service in Axis. I dont want to generate clases to do this but
rather understand what is going on first. Lets say I have the
following wsdl:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
targetNamespace="http://localhost:8080/Candied_Services/services/Version"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://localhost:8080/Candied_Services/services/Version"
xmlns:intf="http://localhost:8080/Candied_Services/services/Version"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--
WSDL created by Apache Axis version: 1.2RC1
Built on Sep 29, 2004 (08:29:40 EDT)
-->
<wsdl:message name="getVersionResponse">
<wsdl:part name="getVersionReturn" type="soapenc:string"/>
</wsdl:message>
<wsdl:message name="getVersionRequest">
</wsdl:message>
<wsdl:portType name="Version">
<wsdl:operation name="getVersion">
<wsdl:input message="impl:getVersionRequest"
name="getVersionRequest"/>
<wsdl:output message="impl:getVersionResponse"
name="getVersionResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="VersionSoapBinding" type="impl:Version">
<wsdlsoap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getVersion">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getVersionRequest">
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://axis.apache.org"
use="encoded"/>
</wsdl:input>
<wsdl:output name="getVersionResponse">
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://localhost:8080/Candied_Services/services/Version"
use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="VersionService">
<wsdl:port binding="impl:VersionSoapBinding" name="Version">
<wsdlsoap:address
location="http://localhost:8080/Candied_Services/services/Version"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Now I want to make a client to connect to this using the service
factory after the manner of the address client example. This is what I
tried:
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceFactory;
public class CandiedServices {
public static void main(final String[] args) {
final String versionURL =
"http://localhost:8080/Candied_Services/services/Version";
final String versionWSDL =
"http://localhost:8080/Candied_Services/services/Version?wsdl";
final String serviceName = "Version";
final String opName = "getVersion";
try {
final ServiceFactory factory = ServiceFactory.newInstance();
final Service service = factory.createService(new
URL(versionWSDL),
new
QName(versionURL, serviceName));
} catch (final Exception ex) {
ex.printStackTrace();
}
}
}
Unfortunately this doesnt work. I try to run it and I get the following:
javax.xml.rpc.ServiceException: Error processing WSDL document:
javax.xml.rpc.ServiceException: Error processing WSDL document:
javax.xml.rpc.ServiceException: Cannot find service:
{impl:VersionSoapBinding}Version
at org.apache.axis.client.Service.initService(Service.java:239)
at org.apache.axis.client.Service.<init>(Service.java:154)
at
org.apache.axis.client.ServiceFactory.createService(ServiceFactory.java:198)
at
com.bmw.candy.candiedServices.client.CandiedServices.main(CandiedServices.java:31)
Now I have tried all manner of things in the namespace uri portion of
the QName and nothing works. Obviously I am misunderstanding something
and I would beappreciative of any help.
Thanks in advance.
-- Robert
begin:vcard
fn:Robert Simmons Jr
n:Simmons Jr;Robert
org:jambit GmbH
adr;quoted-printable:;;R=C3=B6ntgenstrasse 7;Martinsried;;82152;Germany
email;internet:[EMAIL PROTECTED]
title:Senior Software Architect / Consultant
note:Author: "Hardcore Java", O'Reilly and Associates, (2004) http://www.oreilly.com/catalog/hardcorejv/index.html
x-mozilla-html:TRUE
url:http://www.jambit.com
version:2.1
end:vcard