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