Integrate Web service (.svc) - c#

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

Related

IRS-A2A: WS Security Header is invalid

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.

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

Human readable URL in azure

I have an azure cloud service with a couple worker roles, a WCF web role and a normal web role containing a couple aspx pages. Both roles are set to use https endpoints.
When testing locally in Visual studio using IIS the default.aspx page and the servicename.svc page both open in the browser. When I publish to azure though, the URL with the random string of characters opens the directory containing the service definition, but I can’t access the default.aspx page from that URL.
For example if my URL is randomstring.cloudapp.net after publishing, randomstring.cloudapp.net/wcfservice.svc works, but randomstring.cloudapp.net/default.aspx does not. I can get to the other page by using the IP address given in azure, but this isn’t really what I need. Furthermore, the cloud service URL does not work at all. mycloudservice.cloudapp.net results in webpage not found.
Do I need to do something special in order to get both the service, and the aspx pages to show up under mycloudservice.cloudapp.net? I can post the config files if need be, but as of right now, I don't think there relevant to the problem.
EDIT:
Just to clarify, I have now published to production, and the service is working [mycloudservice].cloudapp.net/[mywcfservice] and I can get to the website without a 404 error if I enter the port like [mycloudservice].cloudapp.net:8081/default.aspx . Is there a way to make everything show up under [mycloudservice].cloudapp.net/ without entering the port number so I can just type in [mycloudservice].cloudapp.net/[mywcfservice] AND [mycloudservice].cloudapp.net/default.aspx into the browser?
First, I guess you published your project to the stage slot of your cloud service. It's [Deployment ID].cloudapp.net. You will use the URL you specified if you deploy it to production slot.
Ref the problem, that '[randomstring].cloudapp.net/default.aspx' doesn't work, I'm not sure what you mean by 'doesn't work'. Is it 404 erroe? Or some asp.net runtime error. More information might be helpful.
Check the port numbers. Each of the endpoints (the wcf endpoint and the web endpoint) need to be on different port numbers. You'll need to access them as such when published to Azure.
The random-name issue is from publishing to Staging vs Production, as #Shaun pointed out.

WCF webservice running on a two server cluster, with loadbalancer, resolving web service address

Apologies for the long winded title but looking for a solution to what might be a common problem.
We have a loadbalancer with address, say: www.myloadbalancer.com
Below are two web servers
First server: webserver1.farm.com
Second server: webserver2.farm.com
We deployed a webservice on to the two servers but noticed something funny when trying to consume the web services somewhere else.
We deploy to:
webserver1.farm.com/service1.svc and
webserver2.farm.com/service1.svc
Because the web servers are not directly accessible online you have to go through the load balancer.
So the address to consume is www.myloadbalancer.com/service1.svc.
However what we are finding is that if the loadbalancer directs you to server 1, and you check the WSDL, you see the service name and details as webserver1.farm.com/service1.svc not www.myloadbalancer.com/service1.svc.
If you attempt to consume www.myloadbalancer.com/service1.svc, say in Visual Studio 2008, you get a warning that webserver1.farm.com/service1.svc does not exist.
The main question is, is it possible to give an alias name to a webservice.
in other words is it possible to get the service to describe itself as www.myloadbalancer.com/service1.svc regardless of whether we end up on web server 1 or 2?
A WSDL file is a WSDL file. Edit it to point to the correct URL. (You don't have to use the auto-generated http://webserver1.farm.com/service1.svc?WSDL if you don't want to.)

.NET Web Service - Host name resolving improperly

Duplicate: This is the exact same question, from the exact same person, as Issue with Incorrect URLs in the WSDL of a .NET Web Service, and has the exact same answer. Let's please close this and merge it with the other.
We have installed an ASP.NET web site on a client's server. This site has a web service with a couple of web methods that are called by a Flash object in order to display a news feed. If you browse to their site (ex: www.domain.com), everything's working fine except the flash.
The issue is that when we browse to the .asmx, the header shows that the Host is a subdomain internal to their network (internal.domain.com). Obviously this doesn't resolve to any public IP when browsing from outside of their network. This causes the Flash to fail since the flash object is embedded on a page and is therefore running client side.
I checked the computer name on the server in question, and it doesn't even match "internal.domain.com" - it is something completely different. Where is it getting this information from. It is not coming from IIS, since we have no host headers set up, and the IP for the site is set to (all unassigned).
We either need to force the web service to run against a specific host, or we need to change something on the server so that it resolves to a valid public-facing host name. Any and all help is greatly appreciated!!!!
Web service host names are usually configured in the web.config when being consumed by .NET. When they are being consumed by flash you might need to go looking in the flash file. (my guess is that it is still configured for some sort of SIT environment.
I'm not sure of the details of this, but I've seen this complaint with respect to WCF. The answer had to do with setting the host headers in IIS.
It's IIS that passes the host name to ASP.NET or WCF, and it passes the host header when that is configured. If it's not configured, then I suppose it won't send that header as the "host name", even if the client sets that header in the request.

Categories

Resources