How to compare two WSDL files located in separate Web servers - wsdl

I'm using some legacy .asmx files. I need to compare if the WSDL from a Web Service located in Server A is exactly the same as WSDL in Server B.
The problem here is that when I get the ?wsdl as XML and perform the comparison (using WinMerge or C# code), then both files are going to be different.
For instance, if you look at this WSDL file : http://www.webservicex.net/globalweather.asmx?wsdl , you will find some information in the WSDL that belongs to this server exclusively :
<wsdl:service name="GlobalWeather">
<wsdl:port name="GlobalWeatherSoap" binding="tns:GlobalWeatherSoap">
<soap:address location="http://www.webservicex.net/globalweather.asmx"/>
</wsdl:port>
<wsdl:port name="GlobalWeatherSoap12" binding="tns:GlobalWeatherSoap12">
<soap12:address location="http://www.webservicex.net/globalweather.asmx"/>
</wsdl:port>
<wsdl:port name="GlobalWeatherHttpGet" binding="tns:GlobalWeatherHttpGet">
<http:address location="http://www.webservicex.net/globalweather.asmx"/>
</wsdl:port>
<wsdl:port name="GlobalWeatherHttpPost" binding="tns:GlobalWeatherHttpPost">
<http:address location="http://www.webservicex.net/globalweather.asmx"/>
</wsdl:port>
</wsdl:service>
So the location is going to be different between servers.
Do you know any approach to achieve this task? And yes, ideally I want to do via C# code, by getting the WSDL from both servers and comparing them.

Related

How is the OperationContractAttribute.Action value is set?

I'm using the "Add Service Reference" option in Visual Studio in order to create a proxy class using a WSDL file given to me by a third party.
I got 2 versions of the WSDL - we'll call them "OLD" and "NEW".
Even though the WSDL files suppose to be the same (the new one got updated methods version) , when creating the proxy classes I get a different values in the OperationContractAttribute.Action.
In the OLD wsdl it looks like that:
[System.ServiceModel.OperationContractAttribute(Action="http://webservices.amadeus.com/SATRQT_13_2_1A", ReplyAction="*")]
In the new wsdl it looks like that:
[System.ServiceModel.OperationContractAttribute(Action="http://xml.amadeus.com/AmadeusWebServicesPT/Air_MultiAvailabilityRequest", ReplyAction="http://xml.amadeus.com/AmadeusWebServicesPT/Air_MultiAvailabilityResponse")]
I can't figure it out from where the "Action" value is taken from.
In the old WSDL the value is valid , but in the new WSDL is completely wrong and I get an exception when trying to use the service in the WS
When I look in the OLD wsdl file i can see a "soapAction" with the same value; this seems to be where it's taken from. However in the NEW wsdl there is a value there exactly like in the OLD wsdl
<wsdl:operation name="Air_MultiAvailability">
<soap:operation soapAction="http://webservices.amadeus.com/SATRQT_13_2_1A" />
Can anyone direct to me to the right place?
Update
After reading some more on the "Action" element I realized that the value that I see in the NEW wsdl is the DEFAULT value (see https://msdn.microsoft.com/en-us/library/system.servicemodel.operationcontractattribute.action(v=vs.110).aspx)
Now I need to understand WHY in the OLD wsdl file we get the Action value to be the correct one (I'm guessing from the soapAction defined in the wsdl file under the correct operation) and in the NEW wsdl there is no match and a default value is populated ?
ok found the problem!
in the WSDL file there were multiple "Operation" with the same name
<wsdl:portType name="WebServices">
<wsdl:operation name="DoSomething">
<wsdl:input message="ns:DoSomething_1_1" />
<wsdl:output message="ns:DoSomething_1_1" />
</wsdl:operation>
<wsdl:operation name="DoSomething">
<wsdl:input message="ns:DoSomething_2_2" />
<wsdl:output message="ns:DoSomething_2_2" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding type="ns:WebServices" name="WebServicesBinding">
<wsdl:operation name="DoSomething">
<soap:operation soapAction="http://webservices.my.com/DoSomething_1_1" />
</wsdl:operation>
<wsdl:operation name="DoSomething">
<soap:operation soapAction="http://webservices.my.com/DoSomething_2_2" />
</wsdl:operation>
</wsdl:binding>
the "DoSomething" got 2 version in this example 1.1 and 2.2
once i deleted\renamed ALL duplicated operations (i had multiple of them) the "Action" value was taken from the "soapAction" element
hope this will help someone in the future !

Configuring Nuget.Server to act as an Orchard CMS module feed

We need a private module feed for Orchard. I'm a bit of a novice when it comes to web services, but the problem we seem to be having is in the different schemas. I set up my remote feed as per Creating Remote Feeds:
http://docs.nuget.org/docs/creating-packages/hosting-your-own-nuget-feeds
For this web service the schema is:
<service xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns="http://www.w3.org/2007/app" xml:base="http://localhost:57641/nuget/">
<workspace>
<atom:title>Default</atom:title>
<collection href="Packages">
<atom:title>Packages</atom:title>
</collection>
</workspace>
</service>
Yet the Orchard schema contains a Screenshots element:
<service xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns="http://www.w3.org/2007/app" xml:base="http://packages.orchardproject.net/FeedService.svc/">
<workspace>
<atom:title>Default</atom:title>
<collection href="Packages">
<atom:title>Packages</atom:title>
</collection>
<collection href="Screenshots">
<atom:title>Screenshots</atom:title>
</collection>
</workspace>
</service>
Is there a way I can configure the Nuget.Server web service to expose this too?
It's quite non-trivial now, as the orchard gallery server and nuget server definitions parted ways somewhat. You can just about get it working by altering the Orchard gallery codebase (it expects several items that are not present in the data), but we abandoned our attempt in the end, as the complexity and altering the core code base was not worth the gain

modify wsdl port name or soap address location for an axis webservice

This issue is with axis2 webservice. The generated wsdl contains the below port and address details:
<wsdl:service name="ServiceName">
<wsdl:port name="ServiceNameHttpSoap11Endpoint" binding="ns:ServiceNameSoap11Binding">
<soap:address location="http://ipaddress/webServiceProject/services/ServiceName.ServiceNameHttpSoap11Endpoint/" />
</wsdl:port>
</wsdl:service>
My requirement is to edit the address location to something simple(with out having the ServiceNameHttpSoap11Endpoint) Is there any setting to customize the generated wsdl ? All I am doing is right click on the project in eclipse and selecting "create webservice".
You can use your service endpoint as
http://ipaddress/webServiceProject/services/ServiceName
which is also right.But in wsdl,service endpoint ends with wsdl port..Both are right..

How to change the binding hostname in WSDL when use the WSO2 ESB?

When I Create Proxy Service use the Custom Proxy
I want to change the hostname from "http://localhost:8280/services/AppointWebServiceProxy.AppointWebServiceProxyHttpSoap11Endpoint" to
"http://10.10.11.176:8280/services/AppointWebServiceProxy.AppointWebServiceProxyHttpSoap11Endpoint"
in the binding from WSDL:
<wsdl:port name="AppointWebServiceProxyHttpSoap11Endpoint" binding="tns:AppointWebServiceProxySoap11Binding">
<soap:address location="http://localhost:8280/services/AppointWebServiceProxy.AppointWebServiceProxyHttpSoap11Endpoint"/>
</wsdl:port>
I have change the <HostName>10.10.11.176</HostName> in the carbon.xml and
change the <parameter name="bind-address" locked="false">10.10.11.176</parameter> in the axis2.xml
but all of that are not work,how coule I do ?
To change the url your service is published, you have to edit the parameter
<parameter name="WSDLEPRPrefix" locked="false">http://hostname os IP address</parameter>
to the value you want at the axis2.xml file, section Transport In (Listeners)
Regards

References to Separate Projects When Configuring Unity?

I read a really cool blog about using Autofac to completely decouple an application. But try as I might (and being horribly new to all this), I just couldn't get Autofac to gel.
I turned to Unity from the MS Patterns & Practices Enterprise Library and that went a whole lot better. To make things unnecessarily hard for myself, I separated out all my stuff into projects as:
UnityDi (Console app)
UnityDi.Contracts (Interfaces)
UntiyDi.Domain (Classes)
UnityDi.Repositories (Data Access)
UnityDi.Services (Access to repository through a service layer)
I used XML configuration to pony up Unity:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration" />
</configSections>
<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
<assembly name="UnityDi.Contracts" />
<assembly name="UnityDi.Domain" />
<assembly name="UnityDi.Services" />
<assembly name="UnityDi.Repositories" />
<namespace name="UnityDi.Contracts" />
<namespace name="UnityDi.Domain" />
<namespace name="UnityDi.Services" />
<namespace name="UnityDi.Repositories" />
<container>
<register type="IUser" mapTo="User"></register>
<register type="IUserService" mapTo="UserService"></register>
<register type="IUserRepository" mapTo="UserRepository"></register>
</container>
</unity>
</configuration>
And got that into a running app, no worries:
private static readonly IUnityContainer Container = new UnityContainer();
...
Container.LoadConfiguration();
BUT in order to do so, I need a reference to all the above projects from my console app.
Is there a way to make the app only ever have a reference to UnityDi.Contracts (the interfaces)? Then the app is well and truly decoupled (admittedly with a sledgehammer).
I hope that is enough of an explanation, I'm totally new to this and I'm being extreme like this to facilitate better learning.
I suspect the reason it looks like you need project references is that without them, VS won't copy the assemblies into your apps bin folder when you hit F5. How would it, it has no way of knowing you need them!
The project references are the quickest solution to the problem. The other thing you could do is add a post-build step to copy the appropriate DLLs to end up in the right directory so you can run the app.

Resources