I am trying to generate C# proxy class for web service from WSDL file using svcutil. Svcutil returns following errors:
Error: Style Document on header authHeader does not match expected style Rpc.
For every method in service there is additional error message:
"Error: Extensions for operation 'methodName' in binding CBS cannot specify different values."
I have tried to access service using soapUI and same WSDL file and it works without a problem.
I have no control over service and no direct communication with team that develops it.
This is link to WSDL.
After a lot of discussions with developers that created the service, we concluded that there are some compatibility problems between .NET and Java.
Service developers made several changes on their side and at one moment, it started working on my side.
Related
I keep going back and forth on using the Service References (proxy client) and creating the SOAP XML manually. I imported the WSDL files into my project as Service References. I use the objects provided by these references to create populate my request.
My Code Base is C# using Visual Studio 2013.
My Service Reference solution runs into the error:
"The WS Security Header in the message is invalid. Please review the transmission instructions outlined in Section 5 of the AIR Submission Composition and Reference Guide located at https://www.irs.gov/for-Tax-Pros/Software-Developers/Information-Returns/Affordable-Care-Act-Information-Return-AIR-Program, correct any issues, and try again."
How are other folks passing Security successfully through the Web Service to the IRS?
Any thoughts on how to resolve the issue I am facing by using the proxy client?
the proxy client?
Update
I have abandoned the approach of using the WSDL files as Service References, and am manually creating the SOAP Request for transmittal.
I have to implement SOAP based communication between a .NET application and a local courier service. They have provided good documentation of their SOAP service with php samples and wsdl schema at http://www.rapido.bg/soap_help/, but I cannot find my way in implementing it for .NET with C#.
I looked at similar problems online and first tried to add the wsdl as Service reference which didn't create the necessary classes, then tried to add it as Web Reference, which generated the classes and methods, but could't generate some of the parameter types as expected. For example the login parameter was generated as string, whereas in the wsdl it is defined as xsd:struct and in the php sample its created and passed as an anonymous class with two fields.
I tried to implement the communication using web requests and building the SOAP messages manually following some other approaches, but still couldn't get it right.
It will be great if someone can get a simple app working or just let me know how to do it.
Thanks.
Try using WseWsdl2.exe, it will generate C# or VB.Net classes for you that can be used to communicate with the SOAP service of your choice.
Using wsdl.exe /l:CS /serverInterface, I generated a C# interface from a WDSL document. I've implemented that interface on a WCF class. The resulting service runs locally:
http://localhost:51454/TapasSim.svc
This shows the default site. The problem appears when I append ?wsdl to the URL:
http://localhost:51454/TapasSim.svc?wsdl
Unlike what I expected, this link does not return a WDSL document! Instead, it points back to the exact web page you get without the ?wsdl. As a result, I cannot reference the web service. If I run svcutil.exe it gives this error:
If you were trying to generate a client, this could be because the
metadata documents did not contain any valid contracts or services or
because all contracts/services were discovered to exist in /reference
assemblies. Verify that you passed all the metadata documents to the
tool.
But I would expect that error to have the same cause as the lack of reply to ?wsdl.
What could cause a WCF .svc service not to generate WSDL?
As it turns out, the problem was mixing two technologies. wdsl.exe belongs to the older "Web References" that predate WCF. The newer tool svcutil.exe is meant for generating WCF "Service Reference" interfaces.
So what happened was that WCF looked for [ServiceContract] and [OperationContract] attributes. When it couldn't find any, it silently did nothing.
The silent suppression of this condition is annoying, to say the least. An error like No service with [ServiceContract] attribute found would really have helped.
Note that you can manually add [ServiceContract], but that will leave you with half "Service Reference" half "Web Reference". The result probably will not work.
I had a problem with getting the WSDL via the IE window provided by starting the debugging session. I had to use a separate window, ensuring I put the HTTPS in the URL.
We are hosting our services on 443 (SSL). When you start up the debugger, even though the IE windows shows http: (80), it was listening for traffic on 443. FYI, this is controlled via the project level setting SSL Enabled
I am a Java developer who has created a rather big Web service that works nice with Java clients or other tools (Soap UI).
One of our clients wants to write a .NET client for the web service and uses the "add service reference" feature of VS2010. According to the client this does not work since our WSDL and XSD files use "Forbidden XML constructs" as defined in this article:
The problem is that we have made heavy usage of xsd:attribute data in WSDL.
So the question is:
Is there a workaround to make .NET stub generation code compliant with WSDL/XSD files that contain xsd:attribute? Is there another .NET library for webservices that supports this feature?
Another question of mine would be why does Microsoft impose these limitations in the first place? Why xsd:attribute is a forbidden costruct in a web service??? Any clues on that?
Probably related: C#.NET Generating web service reference using WSDL (from XML schema) problem
If you have access to a machine with the .NET Framework on it why don't you use svcutil to generate a proxy/config settings for him and send it to him?
See www.svcutil.com for the list of switches and options that are available to you
I have found that if the customer cannot do it one way and you provide a documented (possibly automated) way of doing things then that will generally suffice.
I have tested the HelloWorld.wsdl supplied in the link with the .NET version of Remobjects (http://www.remobjects.com) and it seemed to work fine. I don't have an actual service to test this with but I would suggest that you (or the client :) ) download it and give it a try.
The .NET version can be found here:
http://www.remobjects.com/ro/net.aspx
Apparently the answer is that you should NOT use the modern way of generating stubs with svcutil.exe and instead use the legacy way with wsdl.exe
Creating stubs from the command line with wsdl.exe works fine. The resulting code works as expected and the .NET client connects to the Axis2 Web service.
You are given a WSDL and a sample soap message, is there a good tutorial or sample code in using that WSDL to consume a web service? Does the WSDL follow a certain format in order for which it can be consumed properly? I recall a web service in Java that I changed certain tags and attributes in order for this to work, is there a general convention for the formatting used in WSDLs?
I think this might be harder than #1. You are given a WSDL and a sample soap message. Is there a way to use that given WSDL and not the WSDL generated by C# web service when exposing a web service? Is there a way to somehow "override" the WSDL of the web service to the given web service? Are there any conflicts in formatting and compatibility of the WSDL that ought to be considered?
The quickest and most painless approach is simply to use svcutil to generate the code representing the WSDL. At that point the code produced can be used as a client to query an existing service or you can define a class implemeting the service contact. Once you have the .NET classes the SOAP message example will just serve as documentation.
the default usage would be want you most likely want
svcutil myRemoteService.wsdl
which will generate a a file named [servicename].CS file and an output.config containing the necessary WCF client bindings.
Not sure what you mean by overriding the WSDL as it is the published contract that the service honors. So if you want to change method signatures or behavior it will no longer work as the change will no longer conform to the WSDL.