Adding Web Refrence to Visual Studio while Connected to VPN - c#

i am connected to my clients network using vpn.
I need to use a exposed webservice of the Project server in their network.
when i tried the url http://server:port/service.asmx?wsdl in browser i get the wsdl.
But when i try to add web refrence in visual studio i says There is a error downloading the http://server:port/service.asmx?wsdl.could not resolve proxy.MycompanyDomain.com.
Why it is not by passing my company's domain. How to resolve it.

You could create a concrete WSDL by downloading the file from your browser and crating your web reference against the WSDL file rather than against the URL. This can be useful when you want to be sure you have a copy of the service interface at a point in time (particularly if the service is third party and may have unexpected changes that you want to flag back to them).

Related

Using a URI to access a SOAP webservice instead of IP

I have a test web-service: https://r3reports.retain3d.com/API/Reporting.asmx
In my production i have the following structure:
- IIS Application for my main application
- IIS Application within the main application for my webservice
When running from Visual Studio, my app is able to talk to the webservice without issue (it is pointing at the url above, not a locally hosted version). BUT when it runs in production, the TEST call times out because it is trying to use the IP to get to the webservice instead of the URL name (which is what is configured in IIS for SSL purposes). What am i doing wrong and how can i force the SOAP call to use the URL instead of the IP?
Fixed it, turns out we had to modify the host file on the server to properly map the child app to the right IP (it was resolving to the external IP which wasn't bound to my application instance)

BizTalk does not call WCF service

I have created a local WCF service which has a method InsertOrUpdate(String) which connects to a database and insert/update the data. If I run this service with the tutorial code from here (8) and test it with the WCF Test Client from VS 2013 all works great.
Now I want to call this method via a BizTalk Server application so I have saved the WSDL file from the service and imported it into my BizTalk project via the consume WCF service wizard. Then I have created a small orchestration which looks like this:
The in port points to a directory on my hard drive and looks for all kinds of xml files. The out port is set as HTTP transport to http://localhost:43250/Services/MyService.svc. I have signed and deployed the BizTalk applicationon my local machine and if I put an xml file in the port directory it disappears after a short time but my service is not called. In the BizTalk Management Console I get following error:
The published message could be not forwarded because no subscribers
were found. This error occurs when the subscribed orchestration or
subscribed Sendeport were not registered or some necessary to check
the subscription message properties were not promoted. To resolve this
error, use the BizTalk Administration console.
I'm sure that the XML file is valid and the pipelines are set to XML Receive/Transmit too. Do you have any ideas why it is not working? All this happens on a locale Win 7 x64 machine.
These are the first things I would check in this situation:
0. Restart all your host instances and retest.
When you deploy a Biztalk project, assemblies go in the GAC. Biztalk needs the host instances using these assemblies to be restarted or it will keep using the old ones.
You actually don't need to restart all the host instances, but for the sake of simplicity, try it.
1. Make sure all your deployed items are green
Go in the Biztalk administration console, make sure that:
the orchestration is bound is your Receive and Send port (right
click-> Properties -> Bindings)
the orchestration is enlisted
the SendPort enlisted
2. Make sure your input file is right
When you imported your WCF service in Visual Studio, it should have created XSD files to define the schema you can use.
Right click on the XSD file in TFS and click "Generate Instance".
Now go get the file generated and use it as your input.
If it works now with that file, your test file has a problem.
3. Check the subscription of your send port:
Open the Biztalk admin console
Open "Biztalk Group", click new query and search for a "Subscription"
having the same "Service Name" the same name as your Send Port
The subscription is a filter to decide whether a message will go
through your port or be ignored.
If you bound your SendPort, the filter will be a Boolean
expression uniquely identifying your port, using the property BTS.SPTransportID
Does the whole process won't activate ?
Maybe your input schema doesn't match your input xml.
Please validate your XML against the schema, and then redeploy your project.
Make sure the input port is configured to "XMLReceive", because that pipeline promotes the "MessageType" to the context.
Not sure if you should use "XMLTransmit" on the ws port.
You can also check the message subscriptions via BizTalk Administration Console.

Consuming web services

I have a silverlight application consuming data via RIA. Some methods are exposed in a way that they can be consumed in silverlight as well as in WPF application via Service Reference.On development, these services are called via localhost and everything works fine.I have set my hosts file so that it's all available at subdomain.domain.com.
Now (also after a couple of restarts) when I access .svc via different browsers, I get different responses in Chrome and in Internet explorer on the same URL.
Chrome shows:
[Name of] Service,
To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax: ...
You can also access the service description as a single file: ...
Internet explorer, Firefox shows:
[No name displayed] Service,
To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax: ...
the last part (second url, single file access link) is missing in internet explorer.
But the worst part is, if I enter the same url in VS2012 when adding a service reference, I get this message:
The request failed with HTTP status 404: Not Found. Metadata contains a reference that cannot be resolved: ...
How can a service give three different responses to virtually the same request?
Update: Perhaps useful information is also that this service is not contained in a separate .svc file but is a ProjectDomainService.cs (and AuthenticationDomainService.cs) and .svc urls are somehow caught automatically (no such file exists on server).
And, Chrome behaves the same as Internet explorer if I remove
<add name="Soap" type="Microsoft.ServiceModel.DomainServices.Hosting.SoapXmlEndpointFactory, Microsoft.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
from web.config.
Also, pinging subdomain.domain.com shows my local IP as it should.
The problem seems like it was a simple ID-10-T error. Our company has automatic configuration script set for LAN settings under Internet options (connections).
Unchecking this made hosts entries available to all browsers and everything seems to work as expected/desired. While I did know proxies can cause problems when using hosts file, I was unaware of my system settings (it was not set so that it would be visible in settings, but hidden in a configuration file on a network share).
The only browser that worked under these (old) settings was the one that wasn't installed but a portable copy.
As this fixes my problems, I am not sure weather I can expect other unexpected issues now ... but at least it works.

C# Trying to add a service reference to a WCF service I built on a remote server. Get Access to the path '...' error

I've been going crazy over this one! I've googled this problem and read everything that pertains to this but no luck! I've developed a WCF Service and a test web site to test this service with. These two work together very well (on my machine) when I add the service reference to the test web site, but when I publish the WCF Service to a remote machine and try to add that service reference I get an error that states:
There was an error downloading '\SNMCDEVTEST\sslroot\EncompassService'.
Access to the path '\snmcdevtest\sslroot\EncompassService' is denied.
This is behind the SSL (versus wwwroot) part of the remote servers IIS. I have a self-signed certificate attached to the server and a new application pool attached to the WCF service. I've made sure that everyone has access to this folder, but I still keep on getting this error!
Thanks in advance for your help.
Steve

Programming against WSDL without access to actual webservice

I'm going to use C# to read data from a few webservices. I've done that many times before, but those times I've had direct access to the webservices from my development machine.
In this project I've just been sent a .wsdl file, and a couple of .xsd files for the webservice they have in their local intranet.
I've seen that I can use "Add Web Reference", and point directly to the .wsdl file, so that a C# class is created.
But how can I really test it? I'd like to return some dummy data that I can visualize while I develop. Any tips for this situation?
Mock Webservice
From the above source, a .cs file can be generated by opening a Visual Studio Command Prompt and running something like the following:
wsdl /language:CS /namespace:Your.Namespace.Here
/out:Directory\To\Save\To\ /protocol:SOAP /serverinterface
finally-your-wsdl-file-here.wsdl
You can also try SOAP UI for mocking up service with ease. (Free web service testing tool)
Check:
http://www.soapui.org/gettingstarted/mocking.html
The svcutil.exe tool bundled with the Windows SDK (found at C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin) is a nice command line tool that generates WCF client proxies. I've found this to be a good way to interrogate a WSDL. It'll create an interface for the service and then a proxy class that implements that interface. You can then mock up something else that implements that interface to facilitate testing.
It is easy to create your own server side stub. Assuming you want to do it with WCF, then go here. You can then add some basic logic to get your client working.
You can also use the legacy Web Service functionality via the WSDL tool's /Server option, though I recommend you use WCF.
You may also want to try a product like "Fiddler" (http://www.fiddler2.com)
It allows you to capture HTTP (or HTTPS) packets and send a fake automated reply file back as if the server had sent the response. I use it for my project and it works wonders when the test server goes offline (which is often). I take an old response packet, save it as a text file, then send it back again and the application I'm building has no idea it didn't come from the actual host.
I've also found this article very useful: https://ivangrigoryev.com/en/how-to-mock-a-web-service-in-dot-net/
It describes the steps needed, from downloading the WSDL file and to the creation of the test project:
Get WSDL somehow
In the VS Command Prompt:
wsdl /language:CS /out:C:\Downloads\ /protocol:SOAP /serverinterface C:\Downloads\webservice.wsdl
Create a new ASP .NET Web Application with an empty template
Add the file, generated on step 2, to the project
Add a new service to the project (Add -> New item -> Web Service (ASMX))
Change the class definition in the code for this added web service, so it implements the right interface, e.g replace System.Web.Services.WebService with yours.
Hit Alt+Enter and implement the interface automatically with stubs.
Hit F5, the service will run and your browser will open, copy the URL and use it instead of the real URL.
This works only in .Net Framework since .Net Core and .Net 5 dropped the WCF server support. But I found it acceptable to have the main project on .Net 5, but this mock service on .Net Fw 4.8

Categories