Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Soap Error in WebServices  RSS feed

 
Tiger Scott
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to run the example form the IBM UDDI tutorial.
UDDIProxy uddi = new UDDIProxy();
uddi.setInquiryURL( "http://www-3.ibm.com/services/uddi/testregistry/inquiryapi" );
BusinessList businessList = uddi.find_business( "Acme", null, 0 );
I get a Soap Error:[SOAPException: faultCode=SOAP-ENV:Client; msg=Error opening socket: www-3.ibm.com; targetException=java.lang.IllegalArgumentException: Error opening socket: www-3.ibm.com] at org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnection.java:324) at org.apache.soap.messaging.Message.send(Message.java:123) at com.ibm.uddi.client.UDDIProxy.send(UDDIProxy.java:1215) at com.ibm.uddi.client.UDDIProxy.send(UDDIProxy.java:1187) at com.ibm.uddi.client.UDDIProxy.find_business(UDDIProxy.java:192).
I have added code to set the proxy server/port. I do not get an option to set the id/pwd on the connection.
How do I resolve this.
Thanks
Sanjay
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you behind a firewall? Can you ping http://www-3.ibm.com ?
I've seen problems like this caused by not being able to reach the host...
Kyle
P.S. If you do have firewall problems, consider setting up the local UDDI registry that comes with the WSTK from alphaworks.
------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
 
Tiger Scott
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am behind a firewall and use a proxy server- a typical setup at work.
I can not ping but I can open a URl connection by setting the proxy server params-
java.util.Properties prop = System.getProperties();
prop.put("proxySet", "true");
prop.put("http.proxyHost", "proxy.mycompany.com");
prop.put("http.proxyPort", "8099");

URL Url = new URL("http://www-3.ibm.com/services/uddi/testregistry/inquiryapi");
URLConnection urlconn = Url.openConnection();
String password = "myID:myPwd";
String auth = "Basic " + new sun.misc.BASE64Encoder().encode (password.getBytes());
urlconn.setRequestProperty( "Proxy-Authorization", auth);
System.out.println( "Url Connection opened");
Thre has to be way around- as this is a typical situation.
TIA
Sanjay

[This message has been edited by Jim Yingst (edited November 03, 2001).]
[This message has been edited by Sanjay Bahal (edited November 05, 2001).]
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, at least now we know the problem so we can work on a solution. Let me play around with this a bit when I've got some time...
Kyle
------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try the following -- found this with a Google search but haven't had a chance to try it yet:

You have to import the
"org.apache.soap.transport.http.SOAPHTTPConnection"
class. and then you are ready to go.
The following snippet of code shows how to do this:

String proxyHost = ProxyHostname;
int proxyPort = Proxyport;
// Construct a UDDIProxy object.
UDDIProxy proxy = new UDDIProxy();
// create the transport and set parameters
SOAPHTTPConnection st = new
SOAPHTTPConnection();
st.setProxyHost(proxyHost);
st.setProxyPort(proxyPort);
proxy.setTransport(st);

proxy.setInquiryURL("http://www-3.ibm.com/services/uddi/testregistry/inquiryapi");

Kyle

------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
 
Tiger Scott
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kyle,
Thanks a lot.
I tried this.
I also had to add id/pwd:
st.setPassword("pwd");
st.setProxyUserName("id");
I did go a step further. But I still get an error:
1. 1st time I got this:
[SOAPException: faultCode=SOAP-ENV:Client; msg=Connection reset by peer: JVM_recv in socket input stream read; targetException=java.net.SocketException: Connection reset by peer: JVM_recv in socket input stream read] at org.apache.soap.transport.http.SOAPHTTPConnection.send(Unknown Source)
at org.apache.soap.messaging.Message.send(Unknown Source) at com.ibm.uddi.client.UDDIProxy.send(UDDIProxy.java:1215) at com.ibm.uddi.client.UDDIProxy.send(UDDIProxy.java:1187) at com.ibm.uddi.client.UDDIProxy.find_business(UDDIProxy.java:192) at tutorial.UDDI1.main(UDDI1.java:62)
2. Then I start getting this: it implies it is not getting my id/pwd correctly:
[SOAPException: faultCode=SOAP-ENV:Protocol; msg=Unsupported response content type "text/html", must be: "text/xml". Response was:
<HTML><HEAD><TITLE>Proxy authorization required</TITLE></HEAD> <BODY><H1>Proxy authorization required</H1> Username authentication is required for using this proxy. Either your browser does not perform proxy authorization, or your authorization has failed. </BODY></HTML> ]
I am using the latest soap_2_2 build and my uddi4j also should be latest, I am on win2000.
TIA,
Sanjay
 
Tiger Scott
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I further played with this I can open a URL connection to lets say- http://www.yahoo.com - setting my URL proxy properties
but not to: "http://www-3.ibm.com/services/uddi/testregistry/inquiryapi"
But my browser can point to: http://www-3.ibm.com/services/uddi/testregistry/inquiryapi
I don't know,
TIA
Sanjay
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that's the interesting bit. It appears that you might have a content-sensitive firewall that only allows certain content types through...
Kyle
------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
 
Tiger Scott
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Kyle,
If firewall is an issue my browser would fail too(?). But that is not the case- the URL responds on my browser- even though it gives an error on the URL- something to the effect that the method should be POST.
I changed the code to-
urlconn.setRequestProperty("Method","POST");
This also did not help.
TIA
Sanjay
 
Tiger Scott
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It finally works- One has to do:
st.setProxyPassword(pwd) instead of st.setPassword(pwd);
So one hurdle overcome,
Thanks a lot all,
Sanjay
 
Roy Huang
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is also possible to use this solution:
Update the soap.jar, IBM David Melgar has changed the HTTPUtils.java and the SSLUtils.java, the new version code can be got from
http://www.google.com/search?q=cache:3Oz4-VhFdlY:aspn.activestate.com/ASPN/Mail/Message/Apache-Soap-Dev/752825+soap,+tunnel,+socket&hl=en

They just create a SSL socket for the soap client user who use proxy.
Change the code and compile the class, then update these 2 classes to get the new soap.jar, for the UDDI client java code, you don't need to change.
I have tried this, it works.
 
Tiger Scott
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The link did not work could you mail the code.
Also does the code work for https? Because I have never been able to make it work thru https?
Do we have only got to change soap what about uddi4j?
Thanks
Sanjay
[This message has been edited by Sanjay Bahal (edited November 30, 2001).]
 
Roy Huang
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works for https, I have just used it today.:-)
(I have also used the proxy to enter the inetrnet)
for the link, you just need to search from www.google.com,
with keyword: soap, tunnel, socket
then get the cache link, take care of the revision of Ur soap.jar code. the adavantage of this is that U don't need to change the code in your UDDI java side.
Good luck, if U fail to get the code, tell me again.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!