A client (company, not application) has provided a URL to a php-based web service. When I try to work from its url with SOAPUI, WCFTestClient or SvcUtil, all give various levels of non-success.
It looks very much as though there is a case-sensitivity issue. SvcUtil indicates, for example:
Error: There was an error verifying some XML Schemas generated during
export: Type 'http://www.w3.org/2001/XMLSchema:datetime' is not
declared.
Note the case of what I believe should be DateTime.
Is there a way (tool?) that can help generate the C# client side/translate from case-insensitive WSDL?
Note, my web service experience is modest and the customer's is even less so sorry for the basic question. Thanks!
Related
I have a WCF service based on BizTalk, I'm not sure how it was deployed or generated but as far as I know it was made using the BizTalk wizard for publishing WCF services. The problem is the BizTalk server installation was removed and now the service still here but it doesn't work, when i invoke the URL the service responses an exception: The BizTalk receive location may be disabled. I need to generate a WCF service in order to replace that service. I have one example request and response and the folder with the service, with a lot of stuff, XML, definitions, etc but there are no DLLs. The SVC markup has a reference to a BizTalk logic.
<%# ServiceHost Language="c#" Factory="Microsoft.BizTalk.Adapter.Wcf.Runtime.WSHttpWebServiceHostFactory, Microsoft.BizTalk.Adapter.Wcf.Runtime, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
So here goes my question, does anybody know how to generate a service based on request or response to supplant the service.
If you only have the request and response xml then it's a bit tricky. Even if you manage to recreate the service there is no guarantee that existing service consumers will be able to continue to call the service without any change. However, if you want to have a go, this rough guide will help:
Extract the operation signature from the soap request and response
This should be simple. Just look at the part of the request xml which defines the SOAP body. As an example:
<soap:Body xmlns:m="http://www.bookshop.com/prices">
<m:GetBookPrice>
<param1 xsi:type="xs:string">Metro 2033</param1>
</m:GetBookPrice>
</soap:Body>
This shows that the operation name was called GetBookPrice, and that it takes a string as an argument. Now look at the soap body for the response, for example:
<soap:Body xmlns:m="http://www.bookshop.com/prices">
<m:GetBookPriceResponse>
<return xsi:type="xs:decimal">5.99</return>
</m:GetBookPriceResponse>
</soap:Body>
This tells us that the return type of the operation was decimal:
public decimal GetBookPrice(string bookName);
So now you can recreate the service operation in a vanilla WCF service.
It's possible that the service definition included complex types rather than primitives, in which case you need to infer the types from the request/response xml. If the types are too large, you can try to automatically infer them by:
Infer XSD from XML - you'll need to extract just the request and response types from the request/response files, then run them through xsd.exe, which will try to generate the XSD schemas for your request/response types.
Infer CS from XSD - once you have the XSD files, again use xsd.exe to infer the classes for these files. You can then annotate these classes with the DataContract and DataMember attributes and then you can use them in your service definition.
In conclusion, it's not a task I envy you for - even if you manage to faithfully reconstruct the service and type definitions, you may still find that existing clients cannot call the service based on having missed some optional data which was not present in the request/response files you have.
If you create a client for the service in a blank project using Visual Studio (References > "Add Service Reference") you will get the interface that you need to implement (as well as POCOs for all the parameters).
Then create a new WCF project and use that interface and those classes as your contract.
This way you will honour the existing schema without having to manually interpret it.
Look for WcfServiceDescription.xml file in your service folder, its under \App_Data\Temp folder of your service physical folder (you can check IIS virtual directory where its pointing to find the physical path).
Use this file to publish the service again. Based on the definition in it, make sure, you deploy required assemblies to GAC (e.g. schema or orchestration assemblies) before publishing the service again.
Then you can use BtsWcfServicePublishing.exe tool which you can download from http://www.microsoft.com/en-us/download/details.aspx?id=21973 from command prompt. On this exe pass the WcfServiceDescription.xml file along with its full path
In the end, I used an ashx handler for procesing the request (cambined with the other responses were very helpfull) xml-> generate xsd -> parse and read request. The only problem is the .ashx termination.
I have a web service that I want to consume driven by PHP and SOAP. I can add the web service just fine and I get the list of methods when I added(used add service reference when added). But now I get an error:
Warning 1 Custom tool warning: There was an error verifying some XML Schemas generated during export:
Type 'http://www.w3.org/2001/XMLSchema:struct' is not declared. localPATH:Reference.svcmap 1 1 SOAP_Webservice_Test
From what I understand, this is due to a specific type that I have in my PHP Soap API. I have googled but none of the mentioned fixes does it for me.
Any suggestions how to proceed with my debugging?
Closing this because the problem was not in the client, it was in the soap server I tried to refer to.
I've been trying to give more information to the provider about the error I'm getting when trying to consume one of his WS.
They asked me to use wsdl.exe to execute the following command:
wsdl.exe /l:CS /protocol:SOAP /verbose /sharetypes https:example.com/?wsdl
I did it, and got:
Error: There was an error processing 'https://example.oom?wsdl'.
- There was an error downloading 'https://example.com?wsdl'.
- The request was aborted: Could not create SSL/TLS secure channel.
Thing is that I have a cert to navigate that "https://example.com?wsdl" and I think it's properly installed.
When I try to go to that URL in IE I only need to select the cert from a list and give it a certain permission. Then the wsdl is displayed.
I asked my WS provider to tell me how can I tell the command: "use ssl. Use this cert". They told me to ask my networking team, but I've got no such thing, so I asked google, and I found: 1) enable SSL/TLS (if that means go to: IE > Internet Options > Advanced > SSL/TLS enabled, I did it) and 2) check the cert is installed and available. Which I think it is.
Can anyone tell me what can I do?
How is it that the cert is installed, but the command can't reach it?
Are you saying that you need to supply a client-side certificate to navigate to that web page? If that's the case, I'm not sure you can use the wsdl.exe tool directly to connect to it.
But you don't need to. Load the WSDL up in IE and save it as XML, then point wsdl.exe to the local copy of the file. The only difference in the output will be the default endpoint address embedded in the proxy class. You should be setting that value up at run-time anyway, but you can always just edit the auto-generated C# code and fix it. The actual service and data contracts and the implementation code will be exactly the same.
One caveat: if this WSDL is produced by WCF, you have some extra work to do. WCF produces a federated WSDL definition: often times there are a half-dozen or more separate XSD files that make up the whole WSDL definition. Typically, the connection-related information is found in one file, while the type information is pulled in from somewhere else using tags that look like this:
<wsdl:types>
<xsd:schema targetNamespace="foo">
<xsd:import schemaLocation="https://localhost/Foo.svc?xsd=xsd0" namespace="foo"/>
<xsd:import schemaLocation="https://localhost/Foo.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="https://localhost/Foo.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/Foo.Model"/>
<xsd:import schemaLocation="https://localhost/Foo.svc?xsd=xsd3" namespace="http://schemas.datacontract.org/2004/07/System.Collections.ObjectModel"/>
</xsd:schema>
</wsdl:types>
If that's true, you will need to do two things to get the WSDL you need:
Download all of the files that are referenced; these will be either <?include> directives or <wsdl:import> tags found within the other XMLs file, which pull in a second one. You need to check each new file, as there are often second and third level imports. Put everything into one folder.
Edit all of those include references to remove the URLs and just use local file references.
Once that's done, wsdl.exe should run fine. (In .NET 4.5 there is built-in support for flattening the WSDL file out dynamically, but until then you have to do it manually.)
Download the wsdl into your browsersave it to file and then use wsdl.exe on the local file.
I have the following code for consuming a service that is not working for me. Can anyone suggest what I can do to narrow down whats going wrong? I know this is vague so please tell me what you require to provide any suggestions.
The address is: http://localhost:57667/ExampleService.svc/
When visiting directly I get the 'You have created a service... message'
The code that goes wrong is here. It causes the following error:
_url = "http://localhost:57667/ExampleService.svc";
TextReader textReader = new StringReader(HttpPostClient.Post(new Uri(_url), bodyData.ToString(), _exampleServiceRequestEncoding, Properties.Settings.Default.HttpPostClientExampleAvailabilityTimeout));
ERROR MESSAGE:
When visiting this URL directly: http://localhost:57667/ExampleService.svc/ProcessRequest
The exception message is 'No component for key example.ExternalWebServiceStubs.Example.ExampleService was found'.
Castle.MicroKernel.DefaultKernel.get_Item(String key) at Castle.Facilities.WcfIntegration.WindsorInstanceProvider.GetInstance
many thanks,
The normal practice would be to create a proxy class via svcutil.exe (visual studio command prompt) or "add service reference" to consume the service, and then for you to use the methods of your proxy class to call your service's methods.
This tutorial should help (it's based on Visual Studio 2005, you didn't say what version you were using, but you should get a good grounding)
http://msdn.microsoft.com/en-us/library/bb332338.aspx#msdnwcfhc_topic6
Since troubleshooting wcf services will be lot more easier when you provide web.config element also at service side.
My general guess here is, all the wcf services by default uses wsHttpBinding which will not allow direct calling of service like an asmx service we do.
You can replace wsHttpBinding with basicHttpBinding and disable the security to your service in order to get the service work like you are expecting.
Please add some more details about ExampleService.svc binding and it will help you get this resolved fast
Hope this will help
I'm trying to administer my BES 5.0 servers using C# and the following URL seems to not only tell me to generate a WSDL for an incorrect namespace (does not exist) but it also generates collisions.
http://docs.blackberry.com/en/developers/deliverables/16633/Generate_the_client_proxy_925487_11.jsp
What is the correct way to set up the WSDL for the BES admin api?
The correct way is the following command, one line, with the FQDN of the server:
wsdl.exe /sharetypes /out:C:\Temp\proxy.cs https://myFQDN/baaws/core/ws?wsdl https://myFQDN/baaws/core/wsutil?wsdl https://myFQDN/baaws/emailexchange/ws?wsdl https://myFQDN/baaws/dispatcher/ws?wsdl
Alternate WSDL for Groupwise: (append) baaws/emailgroupwise/ws?wsdl
Alternat WSDL for LotusNotes: (append) baaws/emaildomino/ws?wsdl