hello,
i am working w/ a partner company's webservice, which they wrote in
java.
using a provided webservice.wsdl file, i am able to compile it into a
proxy class, webservice.dll. i can add this assembly reference to my
test ASP.NET C# test project and use it no problem.
problem -- our production ASP.NET project uses strongly-named
assemblies. this .dll will not compile.
there are two solutions, i figure:
1) figure out how to strongly name my new proxy's .dll w/ the .snk
we're using.
2) reference the webservice via Visual Studio's "Add Web Reference" and
see if that works around the problem.
my lead is pushing towards #2. normally this should be easy.... but
this webservice is secure. it uses:
- https
- a certificate login
- a username & password NetworkCredential
my question: how can one make a web reference in VS.NET to something
like this? when i enter the URL to its WSDL in IE like so:
https://someurl.com/theService?wsdl
..IE prompts for the certifcate, then prompts for the login creds, then
lets me see the wsdl info. cool. however, in VS.NET, that doesnt
happen! i only have a URL bar, and it doesnt prompt for anything. doh..
do i tried entering my login creds inline ala:
https://username:password@someurl.com/theService?wsdl
...but it doesnt work.
any suggestions!?
thanks,
matt
Keenan Newton - 17 Feb 2005 06:46 GMT
My opinion is styonrgly name the assembly. It is better to be strongly
named then not strongly names. So how difficult is it? Well its
actually very very easy. IN your web service proxy project add a file
called AssembyInfo.cs. in fact you ASP.Net Soultion should already
have a file with that name and you can just copy the file. Then change
the AssemblyTitle, AssemblyDescription, and AssemblyVersion attributes
to appropriate defintions ofr you web service proxy. at the bottom the
file should be the snk in the AssemblyKeyFile attribute just insure the
snk file that your are going to use is in the correct realtive path to
make it easy just dump it in the main project folder. and thats it it
should take less then a minute to do and all your problems are then
solved. I am storngly against having weak named assemblies especially
something that culd be used across more than one application such as a
web service proxy.
Matthew.DelVecchio@CapitalOneAuto.com - 18 Feb 2005 18:05 GMT
i do not have a web proxy project for this webservice. i thought it
simpler to manually convert the .wsdl into a .cs w/ wsdl.exe, then
compile it w/ csc.exe.
i have strongly named the proxy assembly. however, i found an article
for doing it differently. to strongly name it, all i had to do was open
the proxy .cs, and add:
using System.Reflection
#if STRONG
[assembly: System.Reflection.AssemblyVersion("1.0.0.0")]
[assembly: System.Reflection.AssemblyKeyFile("ourKey.snk")]
[assembly: AssemblyTitle("someName.dll")]
[assembly: AssemblyDescription("some desc.")]
#endif
then re-compile it w/ this switch:
/define:STRONG
...that did the trick, it plays nice with others now.
so it works. but, there is one other reason why i would prever to try
"Add Web Reference" -- i work for a major financial institution, with a
very complex production environment. they are very weary of new
contractors adding 3rd party assemblies, and would rather i find a way
to incorporate it into our project's main .dll. i was under the
impression that doing "Add Web Reference" would achieve this. am i
wrong?
thanks,
matt
Keenan Newton - 18 Feb 2005 18:40 GMT
Well yes youc an do that it. I won't not setup an environment where
all of my code for my entire organization builds into one assembly
though. That is why I suggested the seperate assembly, so as long as
the Main.dll can be strong named all is fine in the world. Again i
would not suggest it as a best practice
Matthew.DelVecchio@CapitalOneAuto.com - 19 Feb 2005 02:12 GMT
most definately all of our code is not compiled into one assembly. many
-- but theyre shared and reusable, thus the compartmental organization
makes sense. in this case, this code is only for one purpose: to allow
a specific page & class to run a webservice to our partner. so
considering the complexity of our rollouts w/ servers across the
country, etc, it makes the most sense to try to keep this code
inclusive.
to this end, what ive done is something so simple i never thought of it
-- simply drop the proxy class .cs into my project folder. it gets
compiled into the project's main .dll. sweet.
thanks,
matt
Keenan Newton - 19 Feb 2005 16:38 GMT