Reputation: 5228
HI,
My job was to create a webservice which acted as another webservice we have, so the client doesn't notice the difference. I created my entire webservice and it works fine as I use it and the outputs all are the same. The thing is, I created a clientapplication where I use the old webservice and if I change the url of the webreference to the new service and retry I get an error:
System.Web.Services.Protocols.SoapException: The server did not recognize the HTTP-header SOAPAction
If I look at the differences in the Reference.cs in my two webservices I notice there's a small difference in attributes which is I think the problem.
New service:
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.3053")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="SprWebServiceSoap", Namespace="http://ws.hl7.trispark.com/")]
public partial class SprWebService : System.Web.Services.Protocols.SoapHttpClientProtocol {
Old service:
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.3053")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="SprWebServiceRemoteBinding", Namespace="http://ws.hl7.trispark.com/")]
public partial class SprWebService : System.Web.Services.Protocols.SoapHttpClientProtocol {
And also the method which is used differs:
New:
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://ws.hl7.trispark.com/invoke", RequestNamespace="http://ws.hl7.trispark.com/", ResponseNamespace="http://ws.hl7.trispark.com/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public invokeResponse invoke(invoke inv) {
Old:
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("invokeResponse", Namespace="http://ws.hl7.trispark.com/types")]
public invokeResponse invoke([System.Xml.Serialization.XmlElementAttribute("invoke", Namespace="http://ws.hl7.trispark.com/types")] invoke invoke1) {
First I thought the problem could be that my version was created in vs2008 and the old one in vs2005 so I recreated it in 2005, but that didn't change anything.
The thing is I don't have the code of the old one so I can't see what specific attributes is used.
Does anyone have any idea which attributes I have to set to get the same thing?
Thanks a lot!
Upvotes: 1
Views: 686
Reputation: 6862
I realize this is an old question, but if your goal is to create a web servive that will be consume exactly like the old one, you should build the new one from the WSDL of the old one. You can do this automagically with visual studio :
http://bloggingabout.net/blogs/jschreuder/archive/2005/05/19/4124.aspx
Upvotes: 0
Reputation: 7303
Try to compare the WSDL of both services - see if you can find any clue there.
To get it you add to the end of the URL ?WSDL
see example at http://aspnet.15seconds.com/010430/SampleService.asmx and http://aspnet.15seconds.com/010430/SampleService.asmx?WSDL respectively.
EDIT:
I am not a WSDL guru and so can't tell you where the issue is.
Another option you may consider is to compare sniffs of the requests to the services - this could provide other clues.
Upvotes: 0
Reputation: 2268
My Guess would be to check the namespace used, I had a similar problem and it drilled down to be a difference in name space problem. Check for:
[WebService(Namespace = "http://tempuri.org/"]
This is default, which might be in your new webservice and your old webservice might be using some other namespace.
Upvotes: 0
Reputation: 1349
Do you have the DLL of the old service? If you have the DLL you could potentially use Reflector to reverse engineer it if it's a .net service.
Upvotes: 1