Loading ...
Sorry, an error occurred while loading the content.

Namespace problems

Expand Messages
  • pgfarr
    I am pretty new to SOAP::Lite and SOAP in general so please excuse any terminology faux pas. I am trying to access a web services interface in a product called
    Message 1 of 3 , Aug 26, 2009
    • 0 Attachment
      I am pretty new to SOAP::Lite and SOAP in general so please excuse any terminology faux pas. I am trying to access a web services interface in a product called AlarmPoint via Perl/SOAP::Lite. I have been able to query it successfully using the SOAPUI tool, but when I use Perl I am stopped with the following fault: "namespace mismatch require http://www.alarmpoint.com/webservices/schema found none". In my request envelope I have added that namespace and I see that in a trace, but the error still continues.

      Any suggestions would be very welcome!

      Here is the Perl code fragment:

      my $AP = new SOAP::Lite (
      proxy => $ENDPOINT
      );

      my $serializer = $AP->serializer();
      $serializer->register_ns( 'http://www.alarmpoint.com/webservices/schema','ns' );
      $serializer->register_ns( 'http://www.alarmpoint.com/webservices/schema','ns0' );

      my $AlarmPoint = $AP->FindCountries => {
      endpoint => $ENDPOINT,
      namespace => 'http://www.alarmpoint.com/webservices/schema',
      soapaction => 'urn:FindCountries',
      parameters => [
      SOAP::Data->new(
      name => 'user', type => 'xs:string', attr => {}, 'ws_user1'
      ),
      SOAP::Data->new(
      name => 'password', type => 'xs:string', attr => {},'XXXXX'
      ),
      SOAP::Data->new(
      name => 'clientTimestamp', type => 'xs:string', attr=> {)
      ),
      SOAP::Data->new(
      name => 'clientIP', type => 'xs:string', attr => {}
      ),
      SOAP::Data->new(
      name => 'clientOSUser', type => 'xs:string', attr =>{}
      ),
      SOAP::Data->new(
      name => 'company', type => 'xs:string', attr => {}, 'Default Company'
      ),
      ], # end parameters
      }, # end FindCountries
      ;

      And the WSDL (at least the relevent part):

      <?xml version="1.0" encoding="UTF-8"?>

      <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:ns0="http://www.alarmpoint.com/webservices/schema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://www.alarmpoint.com/webservices/schema">

      <wsdl:documentation>AlarmPointWebService</wsdl:documentation>

      <wsdl:types>

      <xs:schema xmlns:ns="http://www.alarmpoint.com/webservices/schema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://www.alarmpoint.com/webservices/schema">

      <xs:element name="FindCountries">

      <xs:complexType>

      <xs:sequence>

      <xs:element name="user" nillable="true" type="xs:string"/>

      <xs:element name="password" nillable="true" type="xs:string"/>

      <xs:element name="clientTimestamp" nillable="true" type="xs:string"/>

      <xs:element name="clientIP" nillable="true" type="xs:string"/>

      <xs:element name="clientOSUser" nillable="true" type="xs:string"/>

      <xs:element name="company" nillable="true" type="xs:string"/>

      </xs:sequence>

      </xs:complexType>

      </xs:element>

      <xs:element name="FindCountriesResponse">

      <xs:complexType>

      <xs:sequence>

      <xs:element name="return" nillable="true" type="ns:FindCountriesReturn"/>

      </xs:sequence>

      </xs:complexType>

      </xs:element>

      <xs:complexType name="FindCountriesReturn">

      <xs:sequence>

      <xs:element name="countries" nillable="true" type="ns:SoapCountries"/>

      <xs:element name="serverTimestamp" nillable="true" type="xs:string"/>

      <xs:element name="status" nillable="true" type="xs:string"/>

      </xs:sequence>

      </xs:complexType>

      <xs:complexType name="SoapCountries">

      <xs:sequence>

      <xs:element maxOccurs="unbounded" minOccurs="0" name="country" nillable="true" type="ns:SoapCountry"/>

      </xs:sequence>

      </xs:complexType>

      <xs:complexType name="SoapCountry">

      <xs:sequence>

      <xs:element name="countryCodeOverride" nillable="true" type="xs:string"/>

      <xs:element name="identifier" nillable="true" type="xs:long"/>

      <xs:element name="name" nillable="true" type="xs:string"/>

      </xs:sequence>

      </xs:complexType>
    • Martin Busik
      Hi, ... The fault message is as far ambigous, as you don t know where the server expects an element in that schema. You are using the autodispatch feature
      Message 2 of 3 , Aug 27, 2009
      • 0 Attachment
        Hi,

        > I have been able to query it successfully
        > using the SOAPUI tool, but when I use Perl I am stopped with
        > the following fault: "namespace mismatch require
        > http://www.alarmpoint.com/webservices/schema found none". In
        > my request envelope I have added that namespace and I see
        > that in a trace, but the error still continues.

        The fault message is as far ambigous, as you don't know where the
        server expects an element in that schema.

        You are using the autodispatch feature ($AP->FindCountries) in your example.
        In this
        case, SOAP::Lite does a little bit magic more - compared to
        $AP->call('function',...).
        This "magic" heavy depends on the SOAP::Lite-Version you are using (which
        version are you
        using?)

        I suggest, you post both the (valid) SoapUI and the SOAP::Lite-generated
        requests here.

        Cheers,
        Martin
      • pgfarr
        Found the problem - it was a namespace reference issue. I changed my code to (note the prefix of ns: ). There were some other structure issues that were fixed
        Message 3 of 3 , Aug 27, 2009
        • 0 Attachment
          Found the problem - it was a namespace reference issue. I changed my code to (note the prefix of "ns:"). There were some other structure issues that were fixed too:

          my $ap_resp = $AP->call(
          SOAP::Data->name('ns:FindCountries') =>
          SOAP::Data->name('ns:user' => 'ws_user1'),
          SOAP::Data->name('ns:password' => 'LetMeIn'),
          SOAP::Data->name('ns:clientTimestamp'),
          SOAP::Data->name('ns:clientIP' => ''),
          SOAP::Data->name('ns:clientOSUser' => ''),
          SOAP::Data->name('ns:company' => 'Defaultz Company')
          ), # end FindCountries
          ;

          and the problem is resolved. I have more problems, but I will make a separate post for that.

          --- In soaplite@yahoogroups.com, "pgfarr" <pgfarr@...> wrote:
          >
          > I am pretty new to SOAP::Lite and SOAP in general so please excuse any terminology faux pas. I am trying to access a web services interface in a product called AlarmPoint via Perl/SOAP::Lite. I have been able to query it successfully using the SOAPUI tool, but when I use Perl I am stopped with the following fault: "namespace mismatch require http://www.alarmpoint.com/webservices/schema found none". In my request envelope I have added that namespace and I see that in a trace, but the error still continues.
          >
          > Any suggestions would be very welcome!
          >
          > Here is the Perl code fragment:
          >
          > my $AP = new SOAP::Lite (
          > proxy => $ENDPOINT
          > );
          >
          > my $serializer = $AP->serializer();
          > $serializer->register_ns( 'http://www.alarmpoint.com/webservices/schema','ns' );
          > $serializer->register_ns( 'http://www.alarmpoint.com/webservices/schema','ns0' );
          >
          > my $AlarmPoint = $AP->FindCountries => {
          > endpoint => $ENDPOINT,
          > namespace => 'http://www.alarmpoint.com/webservices/schema',
          > soapaction => 'urn:FindCountries',
          > parameters => [
          > SOAP::Data->new(
          > name => 'user', type => 'xs:string', attr => {}, 'ws_user1'
          > ),
          > SOAP::Data->new(
          > name => 'password', type => 'xs:string', attr => {},'XXXXX'
          > ),
          > SOAP::Data->new(
          > name => 'clientTimestamp', type => 'xs:string', attr=> {)
          > ),
          > SOAP::Data->new(
          > name => 'clientIP', type => 'xs:string', attr => {}
          > ),
          > SOAP::Data->new(
          > name => 'clientOSUser', type => 'xs:string', attr =>{}
          > ),
          > SOAP::Data->new(
          > name => 'company', type => 'xs:string', attr => {}, 'Default Company'
          > ),
          > ], # end parameters
          > }, # end FindCountries
          > ;
        Your message has been successfully submitted and would be delivered to recipients shortly.