开发者

HTTP transport error: java.net.MalformedURLException: no protocol: REPLACE_WITH_ACTUAL_URL

I am using a Stub Based client Approach for JAX RPC This is my Client

package com;

import java.rmi.RemoteException;

import javax.xml.rpc.ServiceException;

import com.client.BookCatalog;
import com.client.Book开发者_StackOverflowCatalogService;
import com.client.BookCatalogService_Impl;

public class Client {

    public static void main(String args[]) throws RemoteException {

        BookCatalogService_Impl service = new BookCatalogService_Impl();

        BookCatalog bc = service.getBookCatalogPort();
        System.out.println(bc.getBookPrice("Web Services"));

    }

}

Exception in thread "main" java.rmi.RemoteException: HTTP transport error: java.net.MalformedURLException: no protocol: REPLACE_WITH_ACTUAL_URL; nested exception is: HTTP transport error: java.net.MalformedURLException: no protocol: REPLACE_WITH_ACTUAL_URL at com.client.BookCatalog_Stub.getBookPrice(BookCatalog_Stub.java:87) at com.Client.main(Client.java:19) Caused by: HTTP transport error: java.net.MalformedURLException: no protocol: REPLACE_WITH_ACTUAL_URL at com.sun.xml.rpc.client.http.HttpClientTransport.invoke(HttpClientTransport.java:148) at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:96) at com.client.BookCatalog_Stub.getBookPrice(BookCatalog_Stub.java:70) ... 1 more


Try using a more specific version of your web service client class constructor, for example:

java.net.URL wsdlLocation = new URL("http://service.com/services/Service?wsdl");
javax.xml.namespace.QName qualifiedServiceName = 
    new QName("http://you.service.namespace", "ServiceName");
BookCatalogService_Impl service = 
    new BookCatalogService_Impl(wsdlLocation, qualifiedServiceName);
...

I was using a constructor that takes only the WSDL location and was getting the same error. Adding the second parameter solved my problem.

Hope this helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜