473,762 Members | 6,675 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.wo a/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.Ser vices.Protocols .SoapRpcMethodA ttribute("",
RequestNamespac e:="http://www.url.com/cgi-bin/WebObjects/SCWebService.wo a/1/ws/WSP",
ResponseNamespa ce:="http://www.url.com/cgi-bin/WebObjects/SCWebService.wo a/1/ws/WSP")>
_
Public Function login(ByVal accessKey As String, ByVal email As
String, ByVal password As String) As
<System.Xml.Ser ialization.Soap ElementAttribut e("loginReturn" )> String
Dim results() As Object = Me.Invoke("logi n", New Object()
{accessKey, email, password})
Return CType(results(0 ), String)
End Function
Public Function Beginlogin(ByVa l accessKey As String, ByVal email As
String, ByVal password As String, ByVal callback As
System.AsyncCal lback, ByVal asyncState As Object) As
System.IAsyncRe sult
Return Me.BeginInvoke( "login", New Object() {accessKey, email,
password}, callback, asyncState)
End Function
Public Function Endlogin(ByVal asyncResult As System.IAsyncRe sult)
As String
Dim results() As Object = Me.EndInvoke(as yncResult)
Return CType(results(0 ), String)
End Function

As you can see, the URL is also contained in the function's initial
<system.web.ser vices ...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 6627
> 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*******@yaho o.com> wrote in message
news:ee******** *************** ***@posting.goo gle.com...
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.wo a/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.Ser vices.Protocols .SoapRpcMethodA ttribute("",
RequestNamespac e:="http://www.url.com/cgi-bin/WebObjects/SCWebService.wo a/1/ws/WSP",
ResponseNamespa ce:="http://www.url.com/cgi-bin/WebObjects/SCWebService.wo a/1/ws/WSP")>
_
Public Function login(ByVal accessKey As String, ByVal email As
String, ByVal password As String) As
<System.Xml.Ser ialization.Soap ElementAttribut e("loginReturn" )> String
Dim results() As Object = Me.Invoke("logi n", New Object()
{accessKey, email, password})
Return CType(results(0 ), String)
End Function
Public Function Beginlogin(ByVa l accessKey As String, ByVal email As
String, ByVal password As String, ByVal callback As
System.AsyncCal lback, ByVal asyncState As Object) As
System.IAsyncRe sult
Return Me.BeginInvoke( "login", New Object() {accessKey, email,
password}, callback, asyncState)
End Function
Public Function Endlogin(ByVal asyncResult As System.IAsyncRe sult)
As String
Dim results() As Object = Me.EndInvoke(as yncResult)
Return CType(results(0 ), String)
End Function

As you can see, the URL is also contained in the function's initial
<system.web.ser vices ...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.SAX Exception: 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******* *******@TK2MSFT NGP11.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.SAX Exception: 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 SomeOtherNamesp ace.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
4445
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 problem with defining my JDBC resource within Tomcat. I am pretty sure that my code is correct (but I am not certain), and the problem is with defining the resource in Tomcat. Has anyone done this before? Any advice would be helpful.
1
2236
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 the same server. The Java application is used to communicate with another server outside the firewall, and is part of a component from a partner company. We need to connect this component to our system built in .NET. The XML messages are sent to...
3
5082
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 our web service (The "Web Service Server") running on a separate machine (also .NET 2.0, Win2003 Server, system 2). The web service server (system 2) itself makes calls to methods in the CRM
1
2618
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 program is as follows import java.sql.*; import java.lang.*; import java.io.*; import java.util.*;
1
4378
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 program is as follows import java.sql.*; import java.lang.*; import java.io.*; import java.util.*;
8
4655
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 displaying records. now i wrote all the JDBC code in .java and i am accessing that code in jsp file. but this time i am getting only exceptions not records. i am keeping my programs here. please crosscheck once and tell where i am wrong code ...
3
2911
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 on the java.library.path: C:\Program Files\Java\jdk1.5.0_12\bin;.;C:\WINDOWS\System32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\j2sdk_nb\j2sdk1.4.2\bin;C:\Program...
1
3367
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 database, what is happening? Here is my error msg: org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 3 in the jsp file: /tutorial/test.jsp Syntax error on tokens, delete these tokens 1: <%@ page...
3
3223
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 = "http://10.29.33.96:80/SSO_Token_Object_locator/resources/getSSOToken"; String file = "/APP/tomcat/apache-tomcat-6.0.14/webapps/SSOAdministration/WEB-INF/persistance/sso/9C148798C559E03C4E3EF20E9CE02485.worker2.obj"; ...
0
10136
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9989
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9811
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8814
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6640
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5266
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3913
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.