I have developed a web service in ASP.NET using C#. One of its web methods returns a complex type created from an xsd schema file using the xsd command.
Many client devices use this web services without a problem. WindowsMobile, PC. All are .Net applications.
Now one VB6 client needs to use this web service using SOAP Toolkit 3.0 and he has a problem probably due to the for different namespaces in the serialized xml data.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetProductionDataMachineryResponse xmlns="http://myFactory.it/">
<GetProductionDataMachineryResult xmlns="http://tempuri.org/XMLSchemaData.xsd">
<ResultRequest>Ok or No Data Found </ResultRequest>
.....
</GetProductionDataMachineryResult>
</GetProductionDataMachineryResponse>
</soap:Body>
</soap:Envelope>
If I remove the following annotations in the .cs file
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/XMLSchemaData.xsd")]
[System.Xml.Serialization.XmlRootAttribute(Namespace="http://tempuri.org/XMLSchemaData.xsd", IsNullable=false)]
the VB6 client works fine. But the other clients need to update the web reference.
There are over 80 other clients so this is not an attractive option.
Is there a way to get this to work with the new client without breaking the old ones?
Related
Hi I am developing web application which contains Siebel web service integration. All request/response cycle will take place through XML. It is basically SOAP service. I do not have idea on siebel and soap xml. I am trying to integrate siebel service in WebAPi2. Client have provided me request and response and created sample service to test. I am able to invoke siebel service in fidler. In my webapi2 i want to integrate service.
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rol="Some Url">
<soapenv:Header/>
<soapenv:Body>
<rol:process>
<rol:IDType>National Id</rol:IDType>
<rol:Type>Customer</rol:Type>
// other parametrs
</rol:process>
</soapenv:Body>
</soapenv:Envelope>
Below is the response
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing">
<env:Header>
<wsa:MessageID>urn:some id</wsa:MessageID>
<wsa:ReplyTo>
<wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
</wsa:ReplyTo>
<wsa:FaultTo>
<wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
</wsa:FaultTo>
</env:Header>
<env:Body>
<processResponse xmlns="some url">
<result>1-198A3H</result>
<Contact_Integration_Id>1-198A3H</Contact_Integration_Id>
<SIEBEL_ERROR_CODE/>
<SIEBEL_ERRROR_MESSAGE/>
</processResponse>
</env:Body>
</env:Envelope>)
Also they have provided Public url to hit the API.
As i do not know Siebel integration in .Net and i did not find any suitable tutorial I am expecting some help from here. Any help/suggestion i get here highly appreciated. Thank you.
Although #AJPerez is correct that this is not really a Siebel issue, I would like to recommend you request for the WSDL (Web Service Definition file) from which your example message is generated. Without it you'll find it hard to use the generic .NET tutorials regarding web services.
.NET has no doubt a generator that takes a WSDL as input and generates a set of classes and functions for you to use.
We have an old bit of code, ASMX WebService, that we have lost the source to. I am trying to replicate the behavior of this so we can take control of it once again without affecting any of the clients.
I have created a class that mimics the behavior and properties of the response, and a soap request returns as follows
<soap:Body>
<LoginResponse>
<LoginResult>
<UserId>string</UserId>
<Password>string</Password>
</LoginResult>
</LoginResponse>
Now the service I am trying to replicate returns
<soap:Body>
<LoginRS xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UserId>string</UserId>
<Password>Password</Password>
</LoginRS>
</soap:Body>
Now LoginRS is the name of the class I have made. My question is how do I make my response look like the second response.
I am replicating this in c# ASMX and am using the following
[WebMethod(MessageName="Login")]
public LoginRS Login(string password, string userId)
Thanks for you time.
If your objective is to reverse engineer the service, and if the service dll is with you, you can use .NET Reflector (google it) to read the dll and provide you the exact source code.
I have created a simple REST web service.. Responses are like
<?xml version="1.0" encoding="utf-8"?>
<ArrayOfTableCategories xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
using this attribute
[XmlSerializerFormat]
However I see no xmlns there... like tempuri...
but when try to make a request I get 400 error if I don't define xmlns="http://tempuri.org" at root element..
Any explanation for this behavior?
This is the same problem as in your last 2 questions.
We have often seen that a WCF service is not able to have a List as a return parameter.
Follow the answer that I gave in this question: Cannot deserialize with XMLSerializer result from WCF webservice
There is a series of SOAP services which I wish to call (across a series of services), and while the end points are well defined & documented, there is no WSDL data... so I decided to build my own.
In order to do so, I built a test WCF service which matches the known interface of the service I wish to call.
I then saved the WSDL it exposed, changed the base address the WSDL references, created my proxy (with wsdl.exe), added it to a test client project, and can successfully create a proxy and make calls which causes the SOAP service to send the expected response... only this expected response is not picked up by the proxy and returned to the calling code.
When looking at the back and forth traffic... I can clearly see that the service is replying with what I want.
Any suggestions as to how I might troubleshoot this and get the proxy to pickup the data?
Given the replies are effectively identical, I'm forced to look back at the differences between what my client is sending and another sends.
A known working app sends it's XML blob starting with the following:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
While my client immediately starts with the envelope (without the xml tag, and with one less namespace):
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
The other difference is that the message within the body is prefixed by a namespace in theirs, while mine it is not... though both define this namespace within the tag.
Ala:
<s:Body>
<u:DoSomething xmlns:u="urn:http://some.namespace.org" />
</s:Body>
VS:
<s:Body>
<DoSomething xmlns="urn:http://some.namespace.org" />
</s:Body>
This is not a namespace:
s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
It's setting the encoding style for the envelope which, even though it's not required per the SOAP spec, may be required by the specific implementation you're talking to. Do you have enough control over what you're sending from the client to get that put on there?
Other than that, the XML PI is not required and I think you're definitely on the right track looking at the body XML. This is almost always the case of some kind of namespace mismatch somewhere. Are you 100% positive the namespace URIs are identical?
The most likely problem is the VS version using a "default" XML namespace. There are soap parsers that I've worked which don't work correctly when using an un-aliased (default) namespaces. If you know using the u: alias works with the service, your proxy should also generate it even when every tag inside the s:Body element is prefixed with the alias.
I'm new to .NET world, yet have to use VStudio C# 2010 (.NET 4.0) to produce a client that requests data from a web service in SOAP Xml fashion. I've searched here for answers but got confused even more. MSDN says that "Building XML Web Service Clients" is legacy for .NET 4.0, i.e. WSDL is legacy. Use "WCF" instead, they say.
In WCF i got lost - too much and too vague. It must be simpler then that...
And all examples that i could find on the web - they all use WSDL, "the legacy".
Here are the definitions of the service i need to use in order to obtain the data from the web service:
request:
POST /catalog.asmx HTTP/1.1
Host: www.somewebsite.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "https://www.somewebsite.com/KeywordSearch"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<KeywordSearch xmlns="https://www.somewebsite.com/">
<searchTerm>string</searchTerm>
<resultsReturned>int</resultsReturned>
</KeywordSearch>
</soap:Body>
</soap:Envelope>
Response:
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
...some stuff...
</soap:Body>
</soap:Envelope>
So, what is the right, or at least most logical way to built this simple client? What tools/libraries/methodologies would you suggest to newbie (assuming VS 2010 C#, .NET 4.0 environment)?
If you have a WSDL/XSD to describe that service, or if you can navigate to an URL to grab that metadata, then WCF with basicHttpBinding would probably be your best bet. WSDL is definitely not "legacy" - if anything is legacy, then it's ASP.NET/ASMX webservices.
Given a WSDL/XSD or a URL where you can connect to, just do an Add Service Reference from within Visual Studio, and you should be up and running calling your WCF service in no time - trust me! You don't need to know all of WCF just to call a simple SOAP web service.... also, with WCF 4.0, lots of things - especially configuration - have been vastly improved and simplified.
As for resoures: there's the MSDN WCF Developer Center which has everything from beginner's tutorials to articles and sample code.
Also, check out the screen cast library up on MSDN for some really useful, 10-15 minute chunks of information on just about any topic related to WCF you might be interested in.