IRS-A2A: WS Security Header is invalid - c#

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.

Related

Integrate Web service (.svc)

I had a .svc file which my end user gave to me for integration of a web service.
I try most of the way the internet mention which is to 'add a web service' but i keep getting an error as follows
The document was understood, but it could not be processed.
- The WSDL document contains links that could not be resolved.
- There was an error downloading 'http://someAddress/VFCSMTStep2StripService/MapManagementServices.svc?xsd=xsd0'.
- The remote name could not be resolved: 'someAddress'
I believe the address is intended to be use within an internal web service.
Does that mean if i cannot connect to that address i cannot carry on the programming as it does not allow me to create and web reference. I am using VS2005.
Do point me to any link if this question is a repeat.
Thanks

Service reference not asking for authentication details

I have created WSDL file and when I add service reference in VisualStudio I can use it to fetch the data. However what I want to achieve is when I add service reference it should ask me for credentials by an authentication windows popping up.
What do I need to add to my WSDL file?
I am attaching link to my WSDL file.
Any help will be appreciated.
https://gist.github.com/anonymous/654fcddcdee2f9848500
There is no way to achieve this when you add a local Wsdl file in the IDE as a service reference to your project.
Unless you place the file on a network file share which will popup and ask for credentials.
Another way would be to host the Wsdl via an IIS web service with basic or windows authentication.
According to your comment you are accessing the WSDL using a URL. The question is this a WCF service endpoint? If so (MEX) meta data exchange is used to provide you the Wsdl. You can change the MEX endpoint to use https mexHttpsBinding. See following link:
https://msdn.microsoft.com/en-us/library/aa967391(v=vs.110).aspx

Error generating c# proxy with svcutil

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.

WCF web service does not return WSDL

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

Call web service over https

What do I need to call a web service over https in C#?
Do I need to get the certificate form the site? How do I use this to call the web service?
There's nothing special or different for calling a web service over https than over http. You generate a client proxy from the WSDL using either svcutil.exe (or Add Service Reference in VS) or wsdl.exe and invoke the method. The lower level classes HttpWebRequest and HttpWebResponse will eventually take care of the actual call and certificates but it should be transparent for your code. Of course the server hosting the web service needs to provide a valid certificate.
I take that you are using Visual Studio to create your projects, if you are it is pretty easy to do. I take that you have the url for the web service that you would like to connect to and it starts with HTTPS.
In your project in the solution explorer (assuming you using Visual Studio), you should see a node saying "References" and another one saying "Web References". Right click on the "Web Reference" and then basically follow the wizard. It is pretty straight forward. You can spec your own Namespace. I usually use the format SomethingAPI. Then use the API as you would like any other object in your project. You will get the intellisense and all.
There might occur known problems with some certificates though. See http://support.microsoft.com/kb/823177/en-us
Do you have a client certificate that has been supplied by the provider of the web service?
If so, there are various different ways of doing this depending upon which version of .NET you are using. What version are you using, and are you limited in how you can generate your client proxy classes?

Categories

Resources