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.
> 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,

Signature
Martin Kulov
http://www.codeattest.com/blogs/martin
MCT
MCSD.NET Early Achiever
tshad - 08 Mar 2006 18:20 GMT
>> 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
[quoted text clipped - 7 lines]
> 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
> Regards,
Martin Kulov - 09 Mar 2006 00:21 GMT
So Tom,
what is your question?
Martin
tshad - 09 Mar 2006 02:13 GMT
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
> So Tom,
>
> what is your question?
>
> Martin
Josh Twist - 09 Mar 2006 14:45 GMT
The config would be the app.config of your web service client (or
web.config if the web service is called from another web service/site).
The web reference generates a proxy class - the is the service class
you use to call your web service and it follows a 'proxy' pattern
(http://www.dofactory.com/Patterns/PatternProxy.aspx) so many of us
call them proxies.
Josh
http://www.thejoyofcode.com/
Josh Twist - 09 Mar 2006 19:05 GMT
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
Josh
http://www.thejoyofcode.com/
tshad - 21 Mar 2006 23:23 GMT
> Hi Tom,
>
[quoted text clipped - 4 lines]
>
> 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
> Josh
> http://www.thejoyofcode.com/
Josh Twist - 22 Mar 2006 15:26 GMT
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/
tshad - 22 Mar 2006 00:37 GMT
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
tshad - 22 Mar 2006 00:50 GMT
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
>I tried to change the Url Programmatically to see if this would solve the
>[][] problem that Microsoft seems to have with Java Web Services.
[quoted text clipped - 24 lines]
>
> Tom