HTTP 传输错误:java.net.MalformedURLException:无协议:REPLACE_WITH_ACTUAL_URL
我正在使用基于存根的客户端方法进行 JAX RPC 这是我的
package com;
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
import com.client.BookCatalog;
import com.client.BookCatalogService;
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"));
}
}
线程“main”java.rmi.RemoteException 中的客户端异常:HTTP 传输错误:java.net.MalformedURLException:无协议:REPLACE_WITH_ACTUAL_URL;嵌套异常是: HTTP 传输错误:java.net.MalformedURLException:无协议:REPLACE_WITH_ACTUAL_URL 在 com.client.BookCatalog_Stub.getBookPrice(BookCatalog_Stub.java:87) 在 com.Client.main(Client.java:19) 原因:HTTP 传输错误:java.net.MalformedURLException:无协议:REPLACE_WITH_ACTUAL_URL 在 com.sun.xml.rpc.client.http.HttpClientTransport.invoke(HttpClientTransport.java:148) 在 com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:96) 在 com.client.BookCatalog_Stub.getBookPrice(BookCatalog_Stub.java:70) ... 1 更多
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.BookCatalogService;
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用更具体版本的 Web 服务客户端类构造函数,例如:
我使用的构造函数仅采用 WSDL 位置,但遇到了相同的错误。添加第二个参数解决了我的问题。
希望这有帮助!
Try using a more specific version of your web service client class constructor, for example:
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!