dcsimg
connecting to MapPoint webservice
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ronin_Warrior
Posted On:   Friday, August 20, 2004 03:32 AM

I have a valid MapPoint web service username and password. I use Axis 1.1 to connect to the Web service. I have used a SimpleHttpSender class after configuring the same to work with Axis 1.1 by placing the client-config.wsdd in the classpath. The code for the SimpleHttpSender class is as follows: ----------------------------------------------------------- /** * Invoke a remote call using an URLConnection. This method is called by Axis. */ public void invoke(MessageContext messageContext) throws AxisFault { try { String userName = messageContext.getUsername(); String password = messageContext.getPassword();    More>>


I have a valid MapPoint web service username and password. I use Axis 1.1 to connect to the Web service.


I have used a SimpleHttpSender class after configuring the same to work with Axis 1.1 by placing the client-config.wsdd in the classpath.


The code for the SimpleHttpSender class is as follows:


-----------------------------------------------------------


			
/**
* Invoke a remote call using an URLConnection. This method is called by Axis.
*/
public void invoke(MessageContext messageContext)
throws AxisFault {
try {
String userName = messageContext.getUsername();
String password = messageContext.getPassword();
if (userName != null && password != null) {
System.out.println("The name and password is : "+ userName+"-"+password);
Authenticator.setDefault(new SimpleAuthenticator(userName, password));
}

URL url = new URL(messageContext.getStrProp(MessageContext.TRANS_URL));
System.out.println("The URL being read is :"+messageContext.getStrProp(MessageContext.TRANS_URL));
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
writeToConnection(conn, messageContext);
readFromConnection(conn, messageContext);
}
catch (Exception e) {
System.out.println("Here in SimpleHttpSender:invoke():Exception thrown ");
throw AxisFault.makeFault(e);
}
finally {
Authenticator.setDefault(null);
}
}


-----------------------------------------------------------


When I try to connect to the web service thorough a sample application, I get an error as shown below:


-----------------------------------------------------------


			
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.net.ProtocolException: Server redirected too many times (20)
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.net.ProtocolException: Server redirected too many times (20)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(Unknown Source)
at java.net.URLConnection.getContentType(Unknown Source)
at java_1_4.SimpleHTTPSender.readFromConnection(SimpleHTTPSender.java:98)
at java_1_4.SimpleHTTPSender.invoke(SimpleHTTPSender.java:62)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:157)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:122)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:183)
at org.apache.axis.client.Call.invokeEngine(Call.java:2682)
at org.apache.axis.client.Call.invoke(Call.java:2665)
at org.apache.axis.client.Call.invoke(Call.java:2355)
at org.apache.axis.client.Call.invoke(Call.java:2278)
at org.apache.axis.client.Call.invoke(Call.java:1772)
at net.mappoint.s.mappoint_30.FindServiceSoapStub.findNearby(FindServiceSoapStub.java:1151)
at com.spatialpoint.mappoint.storelocator.StoreLocator.calculateNearbyStores(StoreLocator.java:511)
at com.spatialpoint.mappoint.storelocator.StoreLocator.getNearbyStores(StoreLocator.java:1127)
at TestUnit.testSOAPHeaders(TestUnit.java:118)
at TestUnit.main(TestUnit.java:46)


----------------------------------------------------------


I have put the proxy settings namely http.proxyHost,http.proxyPort,http.proxyUser,http.proxyPassword correctly in the System using System.getProperties().put()


----------------------------------------------------------


I have also provided the application with the correct credentials for the webservice namely the username and the password. Which are used in the SimpleHttpSender class for the digest authentication.

Help!!! Is this a problem with my internet settings, application or configuration.

Ronin

   <<Less

Re: connecting to MapPoint webservice

Posted By:   Rob_McGovern  
Posted On:   Tuesday, August 24, 2004 10:41 AM

I've been working pretty heavily with the MapPoint Web Services and I've only seen the error you mention once. Unfortunately, we just encountered it on the MapPoint Customer Data Service (to upload custom locations). At the moment, I'd have to guess that it's a network or configuration issue because I've used pretty much the same code you are showing on lots of different systems and it's always worked.

I think that the error shows up because of the combination of the Digest Authentication requirement, and any proxy you may have in place. Unfortunately, I don't konw how to fix it yet. As soon as I figure out an answer I'll post it here.

--Rob
About | Sitemap | Contact