Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / December 2004

Tip: Looking for answers? Try searching our database.

Dynamic endpointreference with wsewsdl2

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tonie - 10 Dec 2004 14:47 GMT
Hi,

I am using the wsewsdl2 tool to create my client-side proxies for accessing
web services.  
The web services are deployed into 4 environments (dev, test, staging, prod).
The proxy generated by the wsewsdl2 tool does not provide a mechanism to
override the endpoint of where the web service resides.
(I am looking at something like the static/dynamic setting on the
WebReferences generated by Visual Studio)

What is the best way to change the endpoint without changing the code when
deploying the projects into other environments ?

Thanks,
Tonie
Softwaremaker - 10 Dec 2004 15:01 GMT
You should still be able to override the url as per normal.

Have you tried to override it using this:

Dim a as new someSecureSvcwse
a.URL = http://somesite.com/dev

Let me know if this works.

Signature

Thank you.

Regards,
Softwaremaker
http://www.softwaremaker.net/blog

=========================================

> Hi,
>
[quoted text clipped - 11 lines]
> Thanks,
> Tonie
Tonie - 13 Dec 2004 07:21 GMT
I am generating the proxy using the wsewsdl2 tool.  It generates as:

[SoapService("http://sib.sanlam.co.za/cra/bds/payroll/2004/10/payroll.wsdl")]
public class PayrollService : SoapClient
{
    public PayrollService() : base( new EndpointReference(new
Uri("PayrollService"), new Uri("http://localhost/services/payroll.ashx")) )
    {
    }

    [SoapMethod("getPayrollList")]
    public getPayrollListResponse getPayrollList( getPayrollList request )
    {
        return (getPayrollListResponse)base.SendRequestResponse("getPayrollList",
request).GetBodyObject( typeof(getPayrollListResponse),
SoapServiceAttribute.TargetNamespace);
    }

    public IAsyncResult BegingetPayrollList( getPayrollList request,
System.AsyncCallback callback, object asyncState)
    {
        return base.BeginSendRequestResponse("getPayrollList", request, callback,
asyncState);
    }

    public getPayrollListResponse EndgetPayrollList( System.IAsyncResult
asyncResult )
    {
        return
(getPayrollListResponse)base.EndSendRequestResponse(asyncResult).GetBodyObject( typeof(getPayrollListResponse), SoapServiceAttribute.TargetNamespace);
    }

}

Because it derives from SoapClient the URL property is not available.
The WSE 2 documentation also states that the Via property is ignored if it
is set after a new instance of the SoapSender class is created.  To set the
Via property, specify it in the soapSender constructor that takes an
EndpointReference.

I can just change the generated code to for instance:

        public PayrollService() : base( new EndpointReference(new
Uri("PayrollService"), new
Uri(System.Configuration.ConfigurationSettings.AppSettings["CRA.Domain.Services.PayrollService"])) ) {
        }

But then when I re-generate the proxy I need to remember to change the code.
I also don't think I can write a class that derives from the proxy class and
hide the generated constructor and show a new constructor as shown above.

I  just want to get some views or best practices on how to deal with this
situation.

Thanks,
Tonie

> You should still be able to override the url as per normal.
>
[quoted text clipped - 22 lines]
> > Thanks,
> > Tonie
SA - 15 Dec 2004 17:02 GMT
Tonie:

While I don't use the tool to generate proxy classes (I write them myself,
much less trouble, such as the issue you're encountering), I believe you
should be able to set the Destination property (not the URL property).

The destination property is of type EndPointReference, so you would go about
it like this:

myProxy.Destination = New EndPointReference(New Uri(http://whatever.com))

HTH,

---

Sven.

> I am generating the proxy using the wsewsdl2 tool.  It generates as:

[SoapService("http://sib.sanlam.co.za/cra/bds/payroll/2004/10/payroll.wsdl")
]
> public class PayrollService : SoapClient
> {
[quoted text clipped - 22 lines]
> {
> return

(getPayrollListResponse)base.EndSendRequestResponse(asyncResult).GetBodyObje
ct( typeof(getPayrollListResponse), SoapServiceAttribute.TargetNamespace);
> }
>
[quoted text clipped - 10 lines]
> public PayrollService() : base( new EndpointReference(new
> Uri("PayrollService"), new

Uri(System.Configuration.ConfigurationSettings.AppSettings["CRA.Domain.Servi
ces.PayrollService"])) ) {
> }
>
[quoted text clipped - 34 lines]
> > > Thanks,
> > > Tonie
Tonie - 20 Dec 2004 10:12 GMT
Sven:

Thanks for the info.  I tried it and it works !
I agree with your comments on writing it yourself, but I need to help a
client and they want to generate the proxies.  (Wsewsdl2 generates the
objects for serializing the SOAP messages, which is helpfull).

Thanks again,
Tonie

> Tonie:
>
[quoted text clipped - 107 lines]
> > > > Thanks,
> > > > Tonie

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.