473,407 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Using a Dynamic URL to connect to a Java Web Service.

JL
I have a VB.NET desktop program that reads/writes data to a server
using a Java-based Web Service. This web service, in identical
formats, is located on several servers with each server being a
different customer and different data content.

To connect with the Java Web Service, I downloaded the WSDL file and
used wsdl.exe to create a .vb class file. In my program, I simply call
the functions of the class to communicate with the server.

For the different servers, I must download each WSDL separately, use
wsdl to create a .vb class for each server, and then compile a
different .exe for each server. I would like to be able to have one
..exe with the URL for the web service stored separately with the
program dynamically connecting to the appropriate web service.

The .vb class created by wsdl.exe contains the following Sub New that
runs when the web service is instantiated:

Public Sub New()
MyBase.New()
Me.Url = "http://www.url.com/cgi-bin/WebObjects/SCWebService.woa/1/ws/WSP"
End Sub

I can easily modify this dynamically. However, each function in the
web service is built something like this:

<System.Web.Services.Protocols.SoapRpcMethodAttrib ute("",
RequestNamespace:="http://www.url.com/cgi-bin/WebObjects/SCWebService.woa/1/ws/WSP",
ResponseNamespace:="http://www.url.com/cgi-bin/WebObjects/SCWebService.woa/1/ws/WSP")>
_
Public Function login(ByVal accessKey As String, ByVal email As
String, ByVal password As String) As
<System.Xml.Serialization.SoapElementAttribute("lo ginReturn")> String
Dim results() As Object = Me.Invoke("login", New Object()
{accessKey, email, password})
Return CType(results(0), String)
End Function
Public Function Beginlogin(ByVal accessKey As String, ByVal email As
String, ByVal password As String, ByVal callback As
System.AsyncCallback, ByVal asyncState As Object) As
System.IAsyncResult
Return Me.BeginInvoke("login", New Object() {accessKey, email,
password}, callback, asyncState)
End Function
Public Function Endlogin(ByVal asyncResult As System.IAsyncResult)
As String
Dim results() As Object = Me.EndInvoke(asyncResult)
Return CType(results(0), String)
End Function

As you can see, the URL is also contained in the function's initial
<system.web.services ...etc > tag. If I understand correctly, this is
something that is used when the program is compiled, not at run-time.
Therefore, this is not something that can be changed at run-time or
dynamically.

Any suggestions on how I can make this web service URL dynamic?

Many Thanks, John L.
Nov 21 '05 #1
3 6595
> Any suggestions on how I can make this web service URL dynamic?

YES,
If the Java web service really is exactly the same on all the servers, then
it should use exactly the same WSDL on all those servers. The request and
response namespaces should not vary across different URLs. If you can get
that to happen, then all you need to change is the Url property on the web
service proxy.

Ignoring or over-riding this namespace would be subverting a key mechanism
for synchronizing and versioning services, interfaces, and request and
response messages. So I would advise against it. Instead, fix the
server-side implementation to be more sane..^H^H^H^H. er, ...more
reasonable.

-D
"JL" <jl*******@yahoo.com> wrote in message
news:ee**************************@posting.google.c om...
I have a VB.NET desktop program that reads/writes data to a server
using a Java-based Web Service. This web service, in identical
formats, is located on several servers with each server being a
different customer and different data content.

To connect with the Java Web Service, I downloaded the WSDL file and
used wsdl.exe to create a .vb class file. In my program, I simply call
the functions of the class to communicate with the server.

For the different servers, I must download each WSDL separately, use
wsdl to create a .vb class for each server, and then compile a
different .exe for each server. I would like to be able to have one
.exe with the URL for the web service stored separately with the
program dynamically connecting to the appropriate web service.

The .vb class created by wsdl.exe contains the following Sub New that
runs when the web service is instantiated:

Public Sub New()
MyBase.New()
Me.Url =
"http://www.url.com/cgi-bin/WebObjects/SCWebService.woa/1/ws/WSP"
End Sub

I can easily modify this dynamically. However, each function in the
web service is built something like this:

<System.Web.Services.Protocols.SoapRpcMethodAttrib ute("",
RequestNamespace:="http://www.url.com/cgi-bin/WebObjects/SCWebService.woa/1/ws/WSP",
ResponseNamespace:="http://www.url.com/cgi-bin/WebObjects/SCWebService.woa/1/ws/WSP")>
_
Public Function login(ByVal accessKey As String, ByVal email As
String, ByVal password As String) As
<System.Xml.Serialization.SoapElementAttribute("lo ginReturn")> String
Dim results() As Object = Me.Invoke("login", New Object()
{accessKey, email, password})
Return CType(results(0), String)
End Function
Public Function Beginlogin(ByVal accessKey As String, ByVal email As
String, ByVal password As String, ByVal callback As
System.AsyncCallback, ByVal asyncState As Object) As
System.IAsyncResult
Return Me.BeginInvoke("login", New Object() {accessKey, email,
password}, callback, asyncState)
End Function
Public Function Endlogin(ByVal asyncResult As System.IAsyncResult)
As String
Dim results() As Object = Me.EndInvoke(asyncResult)
Return CType(results(0), String)
End Function

As you can see, the URL is also contained in the function's initial
<system.web.services ...etc > tag. If I understand correctly, this is
something that is used when the program is compiled, not at run-time.
Therefore, this is not something that can be changed at run-time or
dynamically.

Any suggestions on how I can make this web service URL dynamic?

Many Thanks, John L.

Nov 21 '05 #2
JL
Dino. Thanks for your response and input.

The customer stated that the web service and wsdl on both servers were
the same. On visual inspection, the only differences are the different
URLs (that's expected) and some of the items are in a different order.

Using the VB module that was created for server1, I substitute server2
in the URL property. When calling a function, I get the following
error:

org.xml.sax.SAXException: Deserializing parameter 'wsUser': could not
find deserializer for type
{http://server1.com/cgi-bin/webobject/etc}WSUser.

While I am calling the webservice on server2, it appears that it is
going to server1 for deserializing information and is being rejected.

Any suggestions?

Thanks. John.
"Dino Chiesa [Microsoft]" <di****@online.microsoft.com> wrote in message news:<#R**************@TK2MSFTNGP11.phx.gbl>...
Any suggestions on how I can make this web service URL dynamic?


YES,
If the Java web service really is exactly the same on all the servers, then
it should use exactly the same WSDL on all those servers. The request and
response namespaces should not vary across different URLs. If you can get
that to happen, then all you need to change is the Url property on the web
service proxy.

Ignoring or over-riding this namespace would be subverting a key mechanism
for synchronizing and versioning services, interfaces, and request and
response messages. So I would advise against it. Instead, fix the
server-side implementation to be more sane..^H^H^H^H. er, ...more
reasonable.

Nov 21 '05 #3
JL wrote:
Using the VB module that was created for server1, I substitute server2
in the URL property. When calling a function, I get the following
error:

org.xml.sax.SAXException: Deserializing parameter 'wsUser': could not
find deserializer for type
{http://server1.com/cgi-bin/webobject/etc}WSUser.

While I am calling the webservice on server2, it appears that it is
going to server1 for deserializing information and is being rejected.

Any suggestions?


Yikes!!! Looks like they're allowing the namespace of the schema that the
types are declared in to be generated as the webservice's HTTP URL. This
is a serious issue on their side and there's just no way that you can ever
program for this. The namespace for the schema needs to be fixed if you expect
to be able to communicate with a farm of servers distinguished by difference
URLs. As a rough analogy, it would be like me telling you that the .NET (or
Java for that matter) type MyNamesapce.Foo was the same as SomeOtherNamespace.Foo.
Sure the interfaces of the two classes might be 100% indentical, but the
logical identity of the type just isn't the same.

I wish you nothing but the best of luck trying to explain this and even better
luck getting them to fix the problem! :(

Cheers,
Dre

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jon Dellaria | last post by:
I have been using MySql as the database using JSP's and JavaBeans but recently I have wanted to start using the database connection pooling mechanism built into TomCat. I think I am having a...
1
by: Jonah Olsson | last post by:
Hi guys, I need to listen for incoming requests from a Java web service application (or actually JAXB) on a certain port on the server. The .NET application receiving the request is running on...
3
by: Michael Hoehne | last post by:
Hi, I'm currently facing a problem with a mixed environment using .NET 1.1 and ..NET 2.0 web services. We have a client application (the "client", system 1) running on .NET 2.0/WinXP, calling...
1
by: kommaraju | last post by:
iam a starter to db2 & jdbc.i have a servlet program which connects to ibm db2 using jdbc.when i run this using apache tomcat 4.1.34 , it is showing a error message of HTTP STATUS 500 my jdbc...
1
by: kommaraju | last post by:
iam a starter to db2 & jdbc.i have a servlet program which connects to ibm db2 using jdbc.when i run this using apache tomcat 4.1.34 , it is showing a error message of HTTP STATUS 500 my jdbc...
8
by: menmysql | last post by:
i am not bale to solve this problem since two weeks i am trying to access records from mysql database using jsp. inside this jsp program i wrote all my JDBC code. it is working very nicely and...
3
by: arasub | last post by:
ep 20, 2007 11:25:57 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found...
1
by: hkma08 | last post by:
I dont know I should post JSP error in here or not. If not please redirect me to another one. Thx. I just installed apache tomcat with mysql with java, but i got error when try to connect to mysql...
3
dmjpro
by: dmjpro | last post by:
Have a look at my problem. try{ //String tokenLocatorUrl = "http://erp.iitkgp.ernet.in:80/SSO_Token_Object_locator/resources/getSSOToken"; String tokenLocatorUrl...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.