I recently been assigned a project to develop an internal web service that makes use of an outside service from Sprint. the only thing I have is a .wsdl file web reference from Sprint. When I add the web reference to the project and compile my code, I get a parser error message (posted).

I have used web services before; meaning that they have an extension of .asmx. however, this service has an ?wsdl format and I don't know if there is a real difference. How can I fix the .wsdl file to prevent the compilation error (posted).

If you need copy of .wsdl and .discomap file I can provide that.

Full error code

Parser Error Message: Schema item 'element' named 'getSmsDeliveryStatus' from namespace 'http://www.csapi.org/schema/parlayx/sms/send/v1_0/local'. The global element 'http://www.csapi.org/schema/parlayx/sms/send/v1_0/local:getSmsDeliveryStatus' has already been declared.

Dani AI

Generated

This thread describes a common metadata/import problem rather than a C# language bug: the WSDL/XSD set is declaring the same global XML element more than once in the same XML namespace, so the VS importer/parser fails. That typically happens when the vendor WSDL imports/includes the same schema twice (or two different WSDLs each embed identical types) and gets worse when referenced URLs are unreachable (as pointed out). A corrected WSDL from Sprint is the cleanest fix, but there are practical workarounds.

Practical steps (ordered by least to most intrusive):

  • Ask Sprint for a fixed WSDL (preferred). If they supply corrected metadata, the problem goes away.
  • Mirror the whole metadata set locally (host in an IIS virtual directory as suggested). Download every referenced WSDL/XSD, fix schemaLocation attributes to point to the local copies, then add the web reference against the local URL.
  • Inspect the XSDs for duplicate global element/type declarations. If two files declare the same element in the same targetNamespace, remove or merge the duplicate or convert an accidental xs:include to xs:import if namespaces truly differ.
  • If vendor files cannot be edited, implement a small proxy/wrapper service that exposes a clean metadata surface to internal clients and forwards calls to Sprint.
  • Use wsdl.exe or svcutil.exe on local copies to generate proxies; namespace-remapping options can hide type conflicts.

Security and the RequestSoapContext issue: RequestSoapContext is a WSE class (Microsoft.Web.Services3). If the service expects an X.509 token, add an X509 token (not raw XML elements) via the Security.Tokens collection. Example (WSE 3.0):

using System.Security.Cryptography.X509Certificates;
using Microsoft.Web.Services3.Security.Tokens;

var cert = new X509Certificate2("c:\\certs\\client.pfx", "pfxPassword");
proxy.RequestSoapContext.Security.Tokens.Add(new X509SecurityToken(cert));

If using WCF instead, configure the binding for message/transport security and set client certificates via ClientCredentials.

Quick checklist: capture metadata and SOAP with a proxy (Fiddler), validate each XSD with an XML schema validator, keep local copies under source control, never disable certificate validation in production, and share exact failing import URLs with the vendor for the fastest resolution.

Recommended Answers

All 10 Replies

I recently been assigned a project to develop an internal web service that makes use of an outside service from Sprint. the only thing I have is a .wsdl file web reference from Sprint. When I add the web reference to the project and compile my code, I get a parser error message (posted).

I have used web services before; meaning that they have an extension of .asmx. however, this service has an ?wsdl format and I don't know if there is a real difference. How can I fix the .wsdl file to prevent the compilation error (posted).

If you need copy of .wsdl and .discomap file I can provide that.

Full error code

Parser Error Message: Schema item 'element' named 'getSmsDeliveryStatus' from namespace 'http://www.csapi.org/schema/parlayx/sms/send/v1_0/local'. The global element 'http://www.csapi.org/schema/parlayx/sms/send/v1_0/local:getSmsDeliveryStatus' has already been declared.

Hi There,

WSDL stands for Web Service Description Language, it is a platform independant format for describing a set of network services (in XML) where as ASMX (Active Server Methods) as far I am aware is a Microsoft (ASP.NET) implementation only (being a class of .NET methods).

What are you developing on? (VS 2005/2008/etc) What are you developing with? (VB.NET/C#.NET/etc)

Please post a copy of the WSDL file.

Green2Go

I am developing a web service for our internal client and this web service MUST make use of the Spring .wsdl.

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:tns="http://www.csapi.org/wsdl/parlayx/sms/send/v1_0/service" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:interface="http://www.csapi.org/wsdl/parlayx/sms/send/v1_0/interface" xmlns="http://schemas.xmlsoap.org/wsdl/" name="parlayx_sms_send_service" targetNamespace="http://www.csapi.org/wsdl/parlayx/sms/send/v1_0/service" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:import namespace="http://www.csapi.org/wsdl/parlayx/sms/send/v1_0/interface" location="" />
  <wsdl:types />
  <wsdl:binding name="SendSmsBinding" type="interface:SendSms">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="sendSms">
      <soap:operation soapAction="" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
      <wsdl:fault name="InvalidArgumentException">
        <soap:fault use="literal" name="InvalidArgumentException" namespace="" />
      </wsdl:fault>
      <wsdl:fault name="UnknownEndUserException">
        <soap:fault use="literal" name="UnknownEndUserException" namespace="" />
      </wsdl:fault>
      <wsdl:fault name="MessageTooLongException">
        <soap:fault use="literal" name="MessageTooLongException" namespace="" />
      </wsdl:fault>
      <wsdl:fault name="PolicyException">
        <soap:fault use="literal" name="PolicyException" namespace="" />
      </wsdl:fault>
      <wsdl:fault name="ServiceException">
        <soap:fault use="literal" name="ServiceException" namespace="" />
      </wsdl:fault>
    </wsdl:operation>
    <wsdl:operation name="sendSmsLogo">
      <soap:operation soapAction="" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
      <wsdl:fault name="InvalidArgumentException">
        <soap:fault use="literal" name="InvalidArgumentException" namespace="" />
      </wsdl:fault>
      <wsdl:fault name="UnknownEndUserException">
        <soap:fault use="literal" name="UnknownEndUserException" namespace="" />
      </wsdl:fault>
      <wsdl:fault name="UnsupportedFormatException">
        <soap:fault use="literal" name="UnsupportedFormatException" namespace="" />
      </wsdl:fault>
      <wsdl:fault name="MessageTooLongException">
        <soap:fault use="literal" name="MessageTooLongException" namespace="" />
      </wsdl:fault>
      <wsdl:fault name="PolicyException">
        <soap:fault use="literal" name="PolicyException" namespace="" />
      </wsdl:fault>
      <wsdl:fault name="ServiceException">
        <soap:fault use="literal" name="ServiceException" namespace="" />
      </wsdl:fault>
    </wsdl:operation>
    <wsdl:operation name="sendSmsRingTone">
      <soap:operation soapAction="" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
      <wsdl:fault name="InvalidArgumentException">
        <soap:fault use="literal" name="InvalidArgumentException" namespace="" />
      </wsdl:fault>
      <wsdl:fault name="UnknownEndUserException">
        <soap:fault use="literal" name="UnknownEndUserException" namespace="" />
      </wsdl:fault>
      <wsdl:fault name="UnsupportedFormatException">
        <soap:fault use="literal" name="UnsupportedFormatException" namespace="" />
      </wsdl:fault>
      <wsdl:fault name="MessageTooLongException">
        <soap:fault use="literal" name="MessageTooLongException" namespace="" />
      </wsdl:fault>
      <wsdl:fault name="PolicyException">
        <soap:fault use="literal" name="PolicyException" namespace="" />
      </wsdl:fault>
      <wsdl:fault name="ServiceException">
        <soap:fault use="literal" name="ServiceException" namespace="" />
      </wsdl:fault>
    </wsdl:operation>
    <wsdl:operation name="getSmsDeliveryStatus">
      <soap:operation soapAction="" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
      <wsdl:fault name="UnknownRequestIdentifierException">
        <soap:fault use="literal" name="UnknownRequestIdentifierException" namespace="" />
      </wsdl:fault>
      <wsdl:fault name="ServiceException">
        <soap:fault use="literal" name="ServiceException" namespace="" />
      </wsdl:fault>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="SendSmsService">
    <wsdl:port name="SendSms" binding="tns:SendSmsBinding">
      <soap:address location="" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

You didn't mention what your developing in or on?

Update: I've just brief look at the wsdl file, so far I found these problems:

1) All of the references that point towards 'http://www.csapi.org' don't work!
2) This wsdl file references another wsdl file located at '', I cannot get there server to respond??

All of these will cause issues with VS.NET.

Hi There,

WSDL stands for Web Service Description Language, it is a platform independant format for describing a set of network services (in XML) where as ASMX (Active Server Methods) as far I am aware is a Microsoft (ASP.NET) implementation only (being a class of .NET methods).

What are you developing on? (VS 2005/2008/etc) What are you developing with? (VB.NET/C#.NET/etc)

Please post a copy of the WSDL file.

Green2Go

C#.NET

As I said the WSDL code above contains errors. If you can't access the 'location' url that the WSDL code refers to the service will simply not work. On top of that many of the 'xmlns' urls do not work either.

Additionally, WSDL files are usually kept on the vendors server and referenced from there not on a local machine. I have known VS.NET to be a bit 'picky' using these files from hard drive.

I would tell sprint to give you a decent WSDL file or reference because with this one, unless the urls start working, you've not got a hope in hell of using their service.

Can you access the URL below?:

Yes I can and you are right there is a problem with the wsdl and Sprint is currently working on the repair. However, they have one of the services fix and I am now able to access the methods within. but for some reason, I can't make use of the RequestSoadContext.Security.Elements.Add(xxxx) method. Would this be a function of X509 or a method within the wsdl?

Hi,

we are facing same issue. but the wsdl url is pointing to different server.
Can you please provide us some working sample or example using which we can use .wsdl file.

Thanks in advance.

Hi all ,
Do we have any Solution to above problem ?
I am using parlayx api-s and am facing issues for the tns due to csapi.org .
What to do ?

Thanks .

Hi,
I think the solution is to modify the soap message before it get submitted to server, and during that modification we can add required missing things.

Like i know that soap message has 4 stages SoapMessageStage.BeforeSerialize,SoapMessageStage.AfterSerialize, SoapMessageStage.BeforeDeserialize and SoapMessageStage.AfterDeserialize

this are the section where we can do the modification of soap message.

If you want to test that given WSDL file locally, you might have to set it up first on your Windows Computer which has IIS Service installed. In Computer Management's IIS Service, create a virtual directory under the Default Web Site. In your newly created virtual directory properties, configure the Local Path with a given wsdl file that you saved on your PC. After you have done all of these, then you should be able to add a web reference to your project by using the discovering tool within the Visual Studio.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.