views:

28

answers:

1

I am bad with SOAP. A third party SOAP service gave me example code to use for their api. The code that they give (which I copied to my solution EXACTLY) does not spit out a required prefix before all the tags.

Right now, the code they give me causes me to make requests/responses that have no prefix to all the tags...

<tagName />

. How do I make all the tags look like...

<com:tagName />

Here is the attributes for my WebServicesClient

[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name = "catalogHttpBinding", Namespace = "http://com.etilize.spexlive")]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(CategoryCollection))]
public partial class catalog : Microsoft.Web.Services3.WebServicesClientProtocol
+1  A: 

First of all, you're using WSE, which is obsolete. Don't do that unless you have no other choices at all.

When I say "no other choices", I'm including "can't afford to quit the job".

Secondly, this is not a SOAP issue. It's basic XML. You need your elements to be in a particular namespace. Since it looks like you used the correct obsolete tool to generate your client, chances are that your elements are already in the correct namespace.

It may look wrong to you because you don't realize that, in XML, namespace prefixes don't matter - only the prefix is simply an alias for the namespace, and it's the namespace that matters. In particular, the following three examples are identical:

<a:ElementName xmlns:a="urn:foo"/>

<b:ElementName xmlns:b="urn:foo"/>

<ElementName xmlns="urn:foo"/>

If your vendor actually requires a particular prefix (not a particular namespace), then they are badly broken, are violating International standards, and should be publicly mocked as being incompetent. If every vendor implements their own version of the XML standards, then it won't be long before it's not a standard anymore, and we won't be able to depend on it. Since much of the power of XML comes from the fact that it's a standard, this will be unfortunate.

John Saunders
unfortunately, this vendor's api has so many things wrong with it. I can not simply "add a service reference" because I get many errors like cannot convert "type" to "type[]".There example code is as close as I can get to communicating with their garbage in a way in which they understand. Its funny because I now have to find a way to do this because one part of their api requires the com prefix.
Paul Knopf
Also, I am so annoyed with this vendor, I will mention their name. It is a rather reputable company to. It is Etilizehttp://www.etilize.com/
Paul Knopf