import-bot (20212) [Avatar] Offline
#1
[Originally posted by bheemesh]

Hi ,
>
> I found a problem when working with Ant and Webservices and also I
> have mentioned about the Solution.
> Hope this helps for some one who is facing the same problem.
>
> Book : Java Development Using Ant
> Chapter 15: Working with Web Services.
> Page 360
>
> 1. Existing Line:
>     <arg file="${fetched.dir}/api.wsdl"/>
>
> 2. Problem: This is generating following error:
>     [java] - Exception:
>     [java] java.net.MalformedURLException: unknown protocol: c
>     [java]     at java.net.URL.<init>(URL.java:475)
>     [java]     at java.net.URL.<init>(URL.java:371)
>     [java]     at java.net.URL.<init>(URL.java:325)
>     [java] java.io.IOException: Unable to retrieve WSDL document:
>
>
>
> 3. Solution Found For Me:
>
> <arg value="file:${fetched.dir}/api.wsdl"/>
>
> 4. Comments :
>         Others things are working fine.
>
>         Files generated as mentioned in the book:
>
>        build/generated/soapapi/StockQuoteService.java
>        build/generated/soapapi/StockQuoteServiceSoapBindingStub.java
>        build/generated/soapapi/StockQuoteServiceService.java
>        build/generated/soapapi/StockQuoteServiceServiceLocator.java
>        build/generated/soapapi/Exception.java
>
>         Files actually generated is:
>        
> buildgeneratedsoapapiNetXmethodsServicesStockquoteStockQuoteS
> ervice.java
>        buildgeneratedsoapapiNetXmethodsServicesStockquoteStockQuoteS
> erviceLocator.java
>        buildgeneratedsoapapiNetXmethodsServicesStockquoteStockQuoteP
> ortType.java
>        buildgeneratedsoapapiNetXmethodsServicesStockquoteStockQuoteB
> indingStub.java
>
> Thanks and Regards,
> Bheemesh.C
import-bot (20212) [Avatar] Offline
#2
Re: Problem : Java Development Using An
[Originally posted by erikhatcher]

Thanks for the correction. I have a hunch that it works as-is in some
environments, but not all.
ocampesato (1) [Avatar] Offline
#3
Re: Problem : Java Development Using An
Hello:

I encountered the same situation with a Windows XP machine with JDK 1.4.2/Ant 1.6.1. The client code also needs to be modified, yet I've been unable to do so successfully. Here's what I tried:

OLD CODE
======================================================
//StockQuoteServiceServiceLocator locator;
//locator = new StockQuoteServiceServiceLocator();
//StockQuoteService service;
//service = locator.getStockQuoteService();

NEW CODE
======================================================
NetXmethodsServicesStockquoteStockQuoteServiceLocator locator;
locator =
new NetXmethodsServicesStockquoteStockQuoteServiceLocator();

NetXmethodsServicesStockquoteStockQuoteService service;
service = locator.??????(); <----

Though it's probably very simple, I haven't figured out which method in the "locator" class needs to be invoked in order to get a valid 'service'. Suggestions welcome...


NetXmethodsServicesStockquoteStockQuoteServiceLocator.java
========================================================
/**
* NetXmethodsServicesStockquoteStockQuoteServiceLocator.java
*
* This file was auto-generated from WSDL
* by the Apache Axis Wsdl2java emitter.
*/

package soapapi;

public class NetXmethodsServicesStockquoteStockQuoteServiceLocator extends org.apache.axis.client.Service implements soapapi.NetXmethodsServicesStockquoteStockQuoteService {

/**
* net.xmethods.services.stockquote.StockQuote web service
*/

// Use to get a proxy class for NetXmethodsServicesStockquoteStockQuotePort
private final java.lang.String NetXmethodsServicesStockquoteStockQuotePort_address = "http://64.124.140.30:9090/soap";

public String getNetXmethodsServicesStockquoteStockQuotePortAddress() {
return NetXmethodsServicesStockquoteStockQuotePort_address;
}

public soapapi.NetXmethodsServicesStockquoteStockQuotePortType getNetXmethodsServicesStockquoteStockQuotePort() throws javax.xml.rpc.ServiceException {
java.net.URL endpoint;
try {
endpoint = new java.net.URL(NetXmethodsServicesStockquoteStockQuotePort_address);
}
catch (java.net.MalformedURLException e) {
return null; // unlikely as URL was validated in WSDL2Java
}
return getNetXmethodsServicesStockquoteStockQuotePort(endpoint);
}

public soapapi.NetXmethodsServicesStockquoteStockQuotePortType getNetXmethodsServicesStockquoteStockQuotePort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException {
try {
return new soapapi.NetXmethodsServicesStockquoteStockQuoteBindingStub(portAddress, this);
}
catch (org.apache.axis.AxisFault e) {
return null; // ???
}
}

/**
* For the given interface, get the stub implementation.
* If this service has no port for the given interface,
* then ServiceException is thrown.
*/
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
try {
if (soapapi.NetXmethodsServicesStockquoteStockQuotePortType.class.isAssignableFrom(serviceEndpointInterface)) {
return new soapapi.NetXmethodsServicesStockquoteStockQuoteBindingStub(new java.net.URL(NetXmethodsServicesStockquoteStockQuotePort_address), this);
}
}
catch (Throwable t) {
throw new javax.xml.rpc.ServiceException(t);
}
throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface: " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
}

}