Smart device web service client

Hi!

I can't get web service client working using Visual Studio 2003 (either VB.NET or VC#).

I created a web service in Java, and published to Glassfish (aka Sun App Server 9). Tested using his web interface, works like a charm.

Then I've created a Visual C# Windows application, added a web reference and either methods that return bool and complex objects works - I was amazed!

So, I've created a new Visual C# Smart App project, added a web reference. When I complete this task, and try to compile, I get:

D:\newPP\SmartDeviceApplication3\Web References\usuario\Reference.cs(36): 'System.Xml.Serialization.XmlElementAttribute' does not contain a definition for 'Form'

and so on!

The code is:

[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="http://webservice.everest.info/", ResponseNamespace="http://webservice.everest.info/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]

[return: System.Xml.Serialization.XmlElementAttribute("return", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]

public bool validaUsuario([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string usuario, [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string senha) {

object[] results = this.Invoke("validaUsuario", new object[] {

usuario,

senha});

return ((bool)(results[0]));

}

The namespace is correct, and this code appear be the same as created for Windows application.

If I remove offending code, smart device always send "null" as call parameters, and receive everything as null as return (tested with Emultator and a CN2 device).

I know it's a smart device problem, because Window application written using same visual studio works.

Could someone point me how to accomplish this

Here is wsdl file:

< xml version="1.0" encoding="UTF-8" ><definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://webservice.everest.info/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://webservice.everest.info/" name="UsuarioWSBeanService">
  <types>
    <xsd:schema>
      <xsd:import namespace="http://webservice.everest.info/" schemaLocation="http://192.168.0.1:8080/UsuarioWSBeanService/UsuarioWSBean/__container$publishing$subctx/META-INF/wsdl/UsuarioWSBeanService_schema1.xsd" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"/>
    </xsd:schema>
  </types>
  <message name="validaUsuario">
    <part name="parameters" element="tns:validaUsuario"/>
  </message>
  <message name="validaUsuarioResponse">
    <part name="parameters" element="tns:validaUsuarioResponse"/>
  </message>
  <message name="SessionException">
    <part name="fault" element="tns:SessionException"/>
  </message>
  <message name="trocaSenha">
    <part name="parameters" element="tns:trocaSenha"/>
  </message>
  <message name="trocaSenhaResponse">
    <part name="parameters" element="tns:trocaSenhaResponse"/>
  </message>
  <message name="getUsuario">
    <part name="parameters" element="tns:getUsuario"/>
  </message>
  <message name="getUsuarioResponse">
    <part name="parameters" element="tns:getUsuarioResponse"/>
  </message>
  <portType name="UsuarioWSBean">
    <operation name="validaUsuario">
      <input message="tns:validaUsuario"/>
      <output message="tns:validaUsuarioResponse"/>
      <fault name="SessionException" message="tns:SessionException"/>
    </operation>
    <operation name="trocaSenha">
      <input message="tns:trocaSenha"/>
      <output message="tns:trocaSenhaResponse"/>
      <fault name="SessionException" message="tns:SessionException"/>
    </operation>
    <operation name="getUsuario">
      <input message="tns:getUsuario"/>
      <output message="tns:getUsuarioResponse"/>
      <fault name="SessionException" message="tns:SessionException"/>
    </operation>
  </portType>
  <binding name="UsuarioWSBeanPortBinding" type="tns:UsuarioWSBean">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    <operation name="validaUsuario">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
      <fault name="SessionException">
        <soap:fault name="SessionException" use="literal"/>
      </fault>
    </operation>
    <operation name="trocaSenha">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
      <fault name="SessionException">
        <soap:fault name="SessionException" use="literal"/>
      </fault>
    </operation>
    <operation name="getUsuario">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
      <fault name="SessionException">
        <soap:fault name="SessionException" use="literal"/>
      </fault>
    </operation>
  </binding>
  <service name="UsuarioWSBeanService">
    <port name="UsuarioWSBeanPort" binding="tns:UsuarioWSBeanPortBinding">
      <soap:address location="http://192.168.0.1:8080/UsuarioWSBeanService/UsuarioWSBean" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"/>
    </port>
  </service>
</definitions>


Regards,

Richter




Answer this question

Smart device web service client

  • rivsys

    Thank you for your advise!

    But since I have an Intermec CN2 device with CF 1.0, there is no chance to use CF 2.0.

    Is expected VS know I'm using CF 1.0, and should not use unspecified classes, don't And if WSDL isn't supported, should not VS inform me about this Ex: when creating a Java mobily client, I was warned this wsdl isn't supported by CLDC 1.0 devices...

    Instead, VS creates stub (or proxy) class and required supporting classes (in this case, the "usuario" class - that is a complex type returned by web service).

    Anyway, removing offending code (XmlElementAttribute.Form) make always send "null" and receive "null"... Why



  • Sneh Mani Tripathi

    The XmlElementAttribute.Form property does not exist on the compact framework 1.0. YOu need either to use Compact Framework 2.0 (Visual Studio 2005) or to modify service definition. Could you post a url to the web service WSDL

  • NeTBaPb

    Hmm, I swear I responded to this but for some reason I do not see the response posted.

    The XmlElementAttribute.Form member does not exist on the Compact Framework 1.0. It exists on CF 2.0 (VS 2005).

    If you need to use CF1.0, try the workaround described here



  • Smart device web service client