[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webservices

Re: WebServiceBindingAttribute Location property

Tomas Restrepo

7/8/2003 12:03:00 AM

Hi Craig,

> am developing a WebService that provides custom WSDL
> files for each binding
> using a WebServiceBindingAttribute similiar to the
> following.
>
> [WebServiceBinding(
> Name"BindingName",
> Namespace="BindingNamespace",
> Location="http://localhost/wsdl/Binding.wsdl")]
>
> My problem is that when the full Web Service WSDL is
> generated, import of
> the wsdl references the 'localhost'. Therefore, I cannot
> deploy the Web
> Services on another machine without changing the code.
> This seems to make
> the Location property useless.
>
> <import namespace="BindingNamespace"
> location="http://localhost/wsdl/Binding.wsdl"
> />
>
> Is this a correct assumption? If so, how can a make the
> Location property
> dependent on the local ip address?


Can't you just use a relative URI for the Location attribute:
Location="/wsdl/Binding.wsdl")

--
Tomas Restrepo
tomasr@mvps.org


3 Answers

Shawn Jackson

7/8/2003 12:38:00 PM

0

I tried to use the relative binding, but the wsdl that was generated by
ASP.NET included the following import

<import namespace="BindingNamespace" location="/wsdl/Binding.wsdl" />

which doesn't give sufficient information to the location to be able to
locate it automatically. The client could probably do some string
manipulation and take a guess, but that would nullify the client proxy
generation tools.

Thanks,
craig


*** Sent via Developersdex http://www.develop... ***
Don't just participate in USENET...get rewarded for it!

Craig Neuwirt

7/10/2003 6:58:00 PM

0

Thanks Tomas,

You are correct! I did not realize the it was acceptable to have relative
url in WSDL and that wsdl.exe does correctly handle it. Howerver, I do have
one problem with the generated proxy:

It does not specify the url locaion of the web service in the proxy. My
wsdl looks like this

<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/h...
xmlns:soap="http://schemas.xmlsoap.org/wsdl/s...
xmlns:s="http://www.w3.org/2001/XMLSc...
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encod...
xmlns:i0="http://emsinet.com/services/AC...
xmlns:tm="http://microsoft.com/wsdl/mime/textMatch...
xmlns:mime="http://schemas.xmlsoap.org/wsdl/m...
targetNamespace="http://emsinet.com/services/AC...
xmlns="http://schemas.xmlsoap.org/wsdl/...
<import namespace="http://emsinet.com/services/AC...
location="/acord/wsdl/IAcordLifeServiceUntyped.wsdl" />
<types />
<service name="AcordLifeServiceUntyped">
<port name="LifePnPInterface" binding="i0:LifePnPInterface">
<soap:address
location="http://localhost/acord/impl/AcordLifeServiceUntyped.asmx" />
</port>
<port name="LifeInterface" binding="i0:LifeInterface">
<soap:address
location="http://localhost/acord/impl/AcordLifeServiceUntyped.asmx" />
</port>
</service>
</definitions>

It seems to get confused when I inport the portTypes and bindings.

Any ideas,
craig


"Tomas Restrepo (MVP)" <tomasr@mvps.org> wrote in message
news:OgC39mXRDHA.2240@TK2MSFTNGP11.phx.gbl...
> Craig,
>
> > I tried to use the relative binding, but the wsdl that was generated by
> > ASP.NET included the following import
> >
> > <import namespace="BindingNamespace" location="/wsdl/Binding.wsdl" />
> >
> > which doesn't give sufficient information to the location to be able to
> > locate it automatically. The client could probably do some string
> > manipulation and take a guess, but that would nullify the client proxy
> > generation tools.
>
> Not guessing, but normal URI resolution. AFAIK, relative URIs are not
> fobidden by the WSDL 1.1 spec, so if your tool can't deal with that, it's
> probably a problem in the tool, rather than the WSDL. Also, wsdl.exe, as
far
> as I can see, can deal with it with no problems.
>
> I guess you could also deal with a custom SoapExtensionReflector that
> manipulates the relative URI and turns it into an absolute one...
>
> --
> Tomas Restrepo
> tomasr@mvps.org
>
>


Tomas Restrepo

7/16/2003 3:19:00 AM

0

Hi Craig,

> Thanks Tomas,
>
> You are correct! I did not realize the it was acceptable to have
relative
> url in WSDL and that wsdl.exe does correctly handle it. Howerver, I do
have
> one problem with the generated proxy:
>
> It does not specify the url locaion of the web service in the proxy.
My
> wsdl looks like this
>
> <?xml version="1.0" encoding="utf-8"?>
> <definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/h...
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/s...
> xmlns:s="http://www.w3.org/2001/XMLSc...
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encod...
> xmlns:i0="http://emsinet.com/services/AC...
> xmlns:tm="http://microsoft.com/wsdl/mime/textMatch...
> xmlns:mime="http://schemas.xmlsoap.org/wsdl/m...
> targetNamespace="http://emsinet.com/services/AC...
> xmlns="http://schemas.xmlsoap.org/wsdl/...
> <import namespace="http://emsinet.com/services/AC...
> location="/acord/wsdl/IAcordLifeServiceUntyped.wsdl" />
> <types />
> <service name="AcordLifeServiceUntyped">
> <port name="LifePnPInterface" binding="i0:LifePnPInterface">
> <soap:address
> location="http://localhost/acord/impl/AcordLifeServiceUntyped.asmx" />
> </port>
> <port name="LifeInterface" binding="i0:LifeInterface">
> <soap:address
> location="http://localhost/acord/impl/AcordLifeServiceUntyped.asmx" />
> </port>
> </service>
> </definitions>
>
> It seems to get confused when I inport the portTypes and bindings.


I'm not sure what you're saying here... can you clarify what you mean when
you say that, and what exact errors are you getting?

--
Tomas Restrepo
tomasr@mvps.org