Changing services

T

tshad

I have a site with my services that I am using for testing.

I also have the same set of services on another machine in my DMZ.

The problem I am having, is changing where the services are. When you
create a program to access the services in my test setup, I need to point to
the services to my test machine (which is a URL). How do I easily change
that when I put the program in production where I am going to call the same
set of services, but they are on a different machine (so there would be a
different URL).

Thanks,

Tom.
 
M

Martin Kulov

tshad said:
How do I easily change that when I put the program in production where I
am going to call the same set of services, but they are on a different
machine (so there would be a different URL).

Hi Tom,

select your web reference and open Properties. There you will find property
URL Behavior.
Set this to Dynamic and the Url of your web service proxy will be moved to
your config file. You can easily change it from there even in production
environment.

Regards,

--
Martin Kulov
http://www.codeattest.com/blogs/martin

MCT
MCSD.NET Early Achiever
 
T

tshad

Martin Kulov said:
Hi Tom,

select your web reference and open Properties. There you will find
property URL Behavior.
Set this to Dynamic and the Url of your web service proxy will be moved to
your config file. You can easily change it from there even in production
environment.

Which Config file?

I did change it to Dynamic and now my Properties for this Web Service is:

FolderName: RemoteUser
URL Behavior: Dynamic
Web Reference: http://10.0.0.25:8080/services/RemoteUserService?wsdl

I don't have a Proxy for this (I don't think).

I know if I change the Service to

http://10.1.3.5:8080/services/RemoteUserService?wsdl

Where the production server is, I get some of the same errors I got when I
first set up the Web Service. For some reason, VS doesn't set up Multiple
dimensional arrays correctly if the Service is a Java Service. You have to
go add a second [] to make the service work. If I change the Web Reference,
it seems to want to rebuild it instead of just pointing at the new location
and I have to fix this error again.

Thanks,

Tom
 
T

tshad

First, what is the config file you mentioned?

Do I need a service proxy?

I don't have access at the moment to my production server, where the
Services are, but I have the identical Services on my Development machine -
But as you can see the difference is the IP address.

I am going to be calling about 7 or 8 web services per page for about 15
pages. After I get this all working, I will need to change all the IP
addresses for each page when I put the page onto the Production Server. Is
there a way around having the Web Services being redefined every time I
change the IP address of the page?

For example:

When I add a Web reference the following is added to the reference.cs:

public class NewHireDataBean : DataBean {

/// <remarks/>
public string benefitGroup;

/// <remarks/>
public string[] benefitGroupCodeList;

/// <remarks/>
public string birthDate;

I will get an error when I build this because the above benefitGroupCodeList
has to be changed to:

public string[][] benefitGroupCodeList;

This has to be done for all the fields that are multiple dimensions. There
could be from 1 to 20 of these that have to be fixed. I'm not sure why it
rebuilds the reference if I am not deleting it and am just changing the IP
address.

I was trying to find out if there was a way to tell it not to do this or
find an easier way to handle this then to manually go in and make the
changes.

Thanks,

Tom
 
T

tshad

Josh Twist said:
Hi Tom,

I was looking for this article earlier when I saw you where "calling
about 7 or 8 web services per page". It will be well worth your time to
read it as there are a couple of things to take into account when
calling web services from ASP.NET.

http://msdn.microsoft.com/library/en-us/dnservice/html/service07222003.asp?frame=true

Good article.

I was a little confused on the Threads, however.

******************************************************************
The default two-connection limit for connecting to a Web resource can be
controlled via a configuration element called connectionManagement. The
connectionManagement setting allows you to add the names of sites where you
want a connection limit that is different than the default. The following
can be added to a typical Web.config file to increase the default value for
all servers you are connecting, to a connection limit of 40.

<configuration>
<system.net>
<connectionManagement>
<add address="*" maxconnection="40" />
</connectionManagement>
</system.net>

<system.web>
...
It should be noted that there is never a limit to the number of connections
to your local machine, so if you are connecting to localhost, this setting
has no effect.

******************************************************************
Is the above web.config file on the web server that has the Web Services?

The "add address" is confusing if this is the case, as it isn't connecting
to you. You are connecting to it to get its web services.

Tom
 
T

tshad

I tried to change the Url Programmatically to see if this would solve the
[][] problem that Microsoft seems to have with Java Web Services.

I did try the following to see if I could do this in my program:

Url = RemoteUserService.Url
RemoteUserService.Url =
"http://10.0.0.51:8080/data_connect/services/RemoteUserService"

orginally RemoteUserService.Url is
http://localhost:8080/data_connect/services/RemoteUserService

I thought that might work, but I got the following error (not sure what it
is) but I also got it if I changed the address in the project, compiled and
ran it.

Catch ex As Exception
TextBox1.Text = ex.Message
End Try

I get the following in the message box (ex.message).

"java.lang.reflect.InvocationTargetException"

I assume this is the same multi dimension problem, even if done
programmatically.

Tom
 
T

tshad

The problem seems to be that MS can't interpret the Soap message correctly
to create the variables in the program.

Here is a snippet of the Soap message (wsdl).

- <complexType name="ArrayOf_xsd_string">
- <complexContent>
- <restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]" />
</restriction>
</complexContent>
</complexType>
- <complexType name="ArrayOfArrayOf_xsd_string">
- <complexContent>
- <restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[][]" />
</restriction>
</complexContent>
</complexType>
</schema>
- <schema targetNamespace="http://wsbeans.fwdco.com"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
- <complexType name="ScorpeoDataBean">
- <sequence>
<element name="emailList" nillable="true" type="impl:ArrayOf_xsd_string"
/>
<element name="emailMessage" nillable="true" type="xsd:string" />
<element name="emailPort" nillable="true" type="xsd:string" />
<element name="emailSubject" nillable="true" type="xsd:string" />
<element name="employeeList" nillable="true"
type="impl:ArrayOfArrayOf_xsd_string" />

If you look at the last line it is "impl:ArrayOfArrayOf_xsd_string", which
is defined as wsdl:arrayType="xsd:string[][]".

MS takes the "string" and shows it as "string" and takes the "string[][]"
and sets it as "string[]".

Not sure whether the problem is the way the Soap was set up or how MS
interprets it.

Tom
 
J

Josh Twist

The connection management applies to any client of a web service. If
your web page calls a web service then it applies to your web
application. If your web service calls another web service then it
applies to your web service too. However, if the web service you are
calling is on the same machine, the connections are not limited.

Josh
http://www.thejoyofcode.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top