facebook

Null parameter being passed into web service

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #353935 Reply

    neilrichards
    Participant

    Hi,

    Hoping someone can help. I’ve generated a wsdl file from some web service classes that use annotations, and deployed it successfully on my app server. I then copied the wsdl to a new project, and have used the ‘Test With Web Services Explorer’ to test it. When I did this however, the parameter that gets passed in is null. I understand that this is normally caused by the fully qualified xml name(s) being different, but I used the same wsdl I’m not sure why that would be. Would anyone be able to tell me what I’m doing wrong, or how I can identify the msmatch? The wsdl code is below…

    Many thanks,
    Neil

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3-hudson-390-. -->
    <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
        xmlns:tns="https://supply.ws.zodiac.mgms.com/" 
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" 
        xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
        name="QuotationService" targetNamespace="https://supply.ws.zodiac.mgms.com/">
      <types>
        <xs:schema targetNamespace="https://supply.ws.zodiac.mgms.com/">
        
          <xs:element name="submitQuotation" type="tns:submitQuotation"/>
        
          <xs:element name="submitQuotationResponse" type="tns:submitQuotationResponse"/>
        
          <xs:complexType name="submitQuotation">
            <xs:sequence>
              <xs:element minOccurs="0" name="quotationSubmission" type="tns:quotationSubmission"/>
            </xs:sequence>
          </xs:complexType>
        
          <xs:complexType name="submitQuotationResponse">
            <xs:sequence>
              <xs:element name="resultCode" type="xs:int"/>
              <xs:element minOccurs="0" name="errorMessage" type="xs:string"/>
            </xs:sequence>
          </xs:complexType>
        
          <xs:complexType name="quotationSubmission">
            <xs:sequence>
              <xs:element name="quotation" type="tns:quotation"/>
            </xs:sequence>
            <xs:attribute name="email" type="xs:string" use="required"/>
            <xs:attribute name="password" type="xs:string" use="required"/>
          </xs:complexType>
        
          <xs:complexType name="quotation">
            <xs:sequence>
              <xs:element name="supplierReference" type="xs:string"/>
              <xs:element minOccurs="0" name="generalComments" type="xs:string"/>
              <xs:element name="currency" type="xs:string"/>
              <xs:element name="deliveryCharges" type="xs:double"/>
              <xs:element name="itemsTotal" type="xs:double"/>
              <xs:element name="finalTotal" type="xs:double"/>
              <xs:element minOccurs="0" name="items" type="tns:items"/>
            </xs:sequence>
            <xs:attribute name="vesselCode" type="xs:string" use="required"/>
            <xs:attribute name="supplierCode" type="xs:string" use="required"/>
            <xs:attribute name="documentCode" type="xs:string" use="required"/>
            <xs:attribute name="quotationCode" type="xs:string" use="required"/>
            <xs:attribute name="action" type="tns:action"/>
          </xs:complexType>
        
          <xs:complexType name="items">
            <xs:sequence>
              <xs:element maxOccurs="unbounded" minOccurs="0" name="item" type="tns:quotationItem"/>
            </xs:sequence>
          </xs:complexType>
        
          <xs:complexType name="quotationItem">
            <xs:sequence>
              <xs:element name="unitPrice" type="xs:double"/>
              <xs:element name="discountPc" type="xs:double"/>
              <xs:element name="daysDelivery" type="xs:int"/>
              <xs:element minOccurs="0" name="origin" type="tns:origin"/>
            </xs:sequence>
            <xs:attribute name="itemNumber" type="xs:int" use="required"/>
          </xs:complexType>
        
          <xs:simpleType name="origin">
            <xs:restriction base="xs:string">
              <xs:enumeration value="COPY"/>
              <xs:enumeration value="GENUINE"/>
              <xs:enumeration value="LICENSEE"/>
              <xs:enumeration value="OEM"/>
            </xs:restriction>
          </xs:simpleType>
        
          <xs:simpleType name="action">
            <xs:restriction base="xs:string">
              <xs:enumeration value="QUOTING"/>
              <xs:enumeration value="CANNOT_QUOTE"/>
            </xs:restriction>
          </xs:simpleType>
          
        </xs:schema>
      </types>
      <message name="submitQuotation">
        <part element="tns:submitQuotation" name="parameters"/>
      </message>
      <message name="submitQuotationResponse">
        <part element="tns:submitQuotationResponse" name="parameters"/>
      </message>
      <portType name="QuotationWebServiceImplDelegate">
        <operation name="submitQuotation">
          <input message="tns:submitQuotation"/>
          <output message="tns:submitQuotationResponse"/>
        </operation>
      </portType>
      <binding name="QuotationPortBinding" type="tns:QuotationWebServiceImplDelegate">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="submitQuotation">
          <soap:operation soapAction=""/>
          <input>
            <soap:body use="literal"/>
          </input>
          <output>
            <soap:body use="literal"/>
          </output>
        </operation>
      </binding>
      <service name="QuotationService">
        <port binding="tns:QuotationPortBinding" name="QuotationPort">
          <soap:address location="https://hit334nr/extranet/QuotationService"/>
        </port>
      </service>
    </definitions>
    
    #353942 Reply

    neilrichards
    Participant

    … so my initial attempts were done by just entering the email and password, and removing the quotation (which I now realise was required). I would have expected if to fail validation in this situation, but it didn’t – and just passed a null quotationSubmission through instead. Why would that be?

    Thanks again,
    Neil

    #353950 Reply

    support-swapna
    Moderator

    Neil,

    It might be because the quotation isn’t required (no use=required on it) and so removing it doesn’t fail validation but may pass a null for the quotation. I suggest you also cross post to Web Services development related forums for better support on this query.

    Let us know if you see any issues.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Null parameter being passed into web service

You must be logged in to post in the forum log in