Only 44 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Elements minOccurs=0 nillable=true  RSS feed

 
Patrick Lepage
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I am a bit new in web services. I got a lot of goggle searched and find nothing clear about my interrogations.

I develop a web services that will be contact by a web service client on the same computer. (ask my boss why )

I had a lot of thing done in that regards.

But in testing my web services, I got some NullpointerException.



In my WSDL, the element is label has minOccurs=0 and nillable=true.

In my soap test (with SOAPUI), the XML simply don't define the element. (the SOAP has been validate without error)

In the clientRequest (on java side on websphere), I got a null in the attributes of the object.

Is this the standard way to have optional element?

example:

In WSDL:
<xsd:element minOccurs="0" name="poste" nillable="true" type="xsd:string"/>

SOAP input:
No element TAG has been declared for "poste".

On my object, the getPoste() method return null.


I would expect that a minOccurs=0 should need an empty SOAP Tag. In that regard, the getPoste() will return "". It will be better to do it that way to extract my hundreds of element before passing them to our Legacy system. If I cannot get that, I will be "forced" to do:

if ( clientRequest.getPoste() != null){
legacySystem.setPoste(clientRequest.getPoste();
}

And doing it for hundreds of attribute seems a bit overkill in my regards.

I just wish to know a way, that will extract the information without worrying about the null state. I need to take all the information available and passed them to the legacy system. So, when I do my setter with all those request.getter(), I would need a way to don't care about the state (null) of it.

Patrick Lepage

p.s. Here is my WSDL + my SOAP request. The parameters are in French, it is a constraint of my French Canadian company.

<?xml version="1.0" encoding="UTF-8"?>
<wsdl efinitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:impl="http://service.creation.p1.cbq.com/p1CreationClient" xmlns:intf="http://service.creation.p1.cbq.com/p1CreationClient/ns1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://service.creation.p1.cbq.com/p1CreationClient">
<wsdl:types>
<xsd:schema targetNamespace="http://service.creation.p1.cbq.com/p1CreationClient/ns1" xmlns:intf="http://service.creation.p1.cbq.com/p1CreationClient/ns1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="RequestHeader">
<xsd:sequence>
<xsd:element minOccurs="1" name="messageType" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="version" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="sourceId" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="messageId" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CreationClientRequest">
<xsd:sequence>
<xsd:element minOccurs="1" name="codeUsagerCentrale" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="langueUsager" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="client" nillable="true" type="intf:Client"/>
<xsd:element minOccurs="0" name="profilClient" nillable="true" type="intf rofilClient"/>
<xsd:element minOccurs="0" name="adresseClient" nillable="true" type="intf:ArrayOfAdress"/>
<xsd:element minOccurs="0" name="telephoneClient" nillable="true" type="intf:ArrayOfPhone"/>
<xsd:element minOccurs="0" name="alarme" nillable="true" type="intf:AlerteClient"/>
<xsd:element minOccurs="0" name="commentaire" nillable="true" type="intf:ArrayOfComment"/>

</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CreationClientResponse">
<xsd:sequence>
<xsd:element minOccurs="1" name="completionCode" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="completionMessage" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="header" nillable="true" type="intf:ResponseHeader"/>
<xsd:element minOccurs="1" name="numeroClientCentrale" nillable="true" type="xsd:string"/>

</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ResponseHeader">
<xsd:sequence>
<xsd:element minOccurs="1" name="errorCode" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="errorMessage" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="msgType" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="version" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="sourceId" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="messageId" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>


<xsd:complexType name="Client">
<xsd:sequence>
<xsd:element minOccurs="1" name="nom" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="prenom" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="dateNaissance" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="sexe" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="langue" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="salutation" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="division" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="representant" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="indPersMorale" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="nomPersonneMorale" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ProfilClient">
<xsd:sequence>
<xsd:element minOccurs="0" name="nas" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="rpam" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="ramqNo" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="fumeur" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="codeProf" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="categorieProf" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="etudiant" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="typeSolRefuse" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="dateFinRestriction" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="etatCivile" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="ArrayOfAdress">
<xsd:sequence>
<xsd:element maxOccurs="5" minOccurs="0" name="Adresse" nillable="true" type="intf:AdresseClient"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ArrayOfPhone">
<xsd:sequence>
<xsd:element maxOccurs="11" minOccurs="0" name="Telephone" nillable="true" type="intf:TelClient"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ArrayOfComment">
<xsd:sequence>
<xsd:element maxOccurs="99" minOccurs="0" name="Commentaire" nillable="true" type="intf:CommentaireClient"/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="AdresseClient">
<xsd:sequence>
<xsd:element minOccurs="1" name="referencePostal" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="dateEffective" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="statut" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="type" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="noUnite" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="typeNomRuePtCardinal" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="municipalite" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="provinceEtat" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="pays" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="noMunicipal" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="codePostal" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="infoCompl1" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="infoCompl2" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="adresseCourriel" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TelClient">
<xsd:sequence>
<xsd:element minOccurs="1" name="reference" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="numeroTelephone" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="poste" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="statut" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="dateEffective" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="AlerteClient">
<xsd:sequence>
<xsd:element minOccurs="1" name="dateTerminaison" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CommentaireClient">
<xsd:sequence>
<xsd:element minOccurs="1" name="noSequenceCommentaire" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="1" name="commentaires" nillable="true" type="xsd:string"/>


</xsd:sequence>
</xsd:complexType>
</xsd:schema>
<xsd:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://service.creation.p1.cbq.com/p1CreationClient" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:element name="creationClient">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="INP1-CLA" nillable="true" type="intf:RequestHeader"/>
<xsd:element maxOccurs="1" minOccurs="1" name="INP2-CLA" nillable="true" type="intf:CreationClientRequest"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="creationClientResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="SegmentResponse" nillable="true" type="intf:CreationClientResponse"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

</wsdl:types>



<wsdl:message name="creationClientResponse">
<wsdl art element="impl:creationClientResponse" name="creationClientResponse"/>
</wsdl:message>
<wsdl:message name="creationClientRequest">
<wsdl art element="impl:creationClient" name="creationClient"/>
</wsdl:message>
<wsdl ortType name="P1CreationClientBean">
<wsdl peration name="creationClient">
<wsdl:input message="impl:creationClientRequest" name="creationClientRequest"/>
<wsdl utput message="impl:creationClientResponse" name="creationClientResponse"/>
</wsdl peration>
</wsdl ortType>
<wsdl:binding name="CreationClientServiceHttpBinding" type="impl 1CreationClientBean">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl peration name="creationClient">
<wsdlsoap peration soapAction=""/>
<wsdl:input name="creationClientRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl utput name="creationClientResponse">
<wsdlsoap:body use="literal"/>
</wsdl utput>
</wsdl peration>
</wsdl:binding>
<wsdl:service name="CreationClientService">
<wsdl ort binding="impl:CreationClientServiceHttpBinding" name="P1CreationClientBean">
<wsdlsoap:address location="ANONYMOUS"/>
</wsdl ort>
</wsdl:service>
</wsdl efinitions>


SOAP INPUT:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns 1c="http://service.creation.p1.cbq.com/p1CreationClient">
<soapenv:Header/>
<soapenv:Body>
<p1c:creationClient>
<p1c:INP1-CLA>
<messageType>ANONYMOUS</messageType>
<sourceId>ANONYMOUS</sourceId>
<version>ANONYMOUS</version>
<messageId>ANONYMOUS</messageId>
</p1c:INP1-CLA>
<p1c:INP2-CLA>
<codeUsagerCentrale>CCOU</codeUsagerCentrale>
<langueUsager>F</langueUsager>
<!--Optional:-->
<client>
<nom>TEST</nom>
<!--Optional:-->
<prenom>CREATION</prenom>
<dateNaissance>19660707</dateNaissance>
<!--Optional:-->
<sexe>F</sexe>
<langue>F</langue>
<!--Optional:-->
<salutation>ME</salutation>
<division>CBQ</division>
<representant>20099148</representant>
<indPersMorale>N</indPersMorale>
<!--Optional:-->
<nomPersonneMorale>Nom Personne Morale</nomPersonneMorale>
</client>
<!--Optional:-->
<profilClient>
<!--Optional:-->
<nas>222333444</nas>
<!--Optional:-->
<rpam>QC</rpam>
<!--Optional:-->
<ramqNo>COUC66570701</ramqNo>
<!--Optional:-->
<fumeur>N</fumeur>
<!--Optional:-->
<codeProf>A</codeProf>
<!--Optional:-->
<categorieProf>2A</categorieProf>
<!--Optional:-->
<etudiant>N</etudiant>
<!--Optional:-->
<typeSolRefuse>TOUS</typeSolRefuse>
<!--Optional:-->
<dateFinRestriction>20120202</dateFinRestriction>
<!--Optional:-->
<etatCivile>D</etatCivile>
</profilClient>
<!--Optional:-->
<adresseClient>
<!--0 to 5 repetitions:-->
<Adresse>
<referencePostal>DOMICILE-1</referencePostal>
<dateEffective>20070101</dateEffective>
<statut>V</statut>
<type>C</type>
<!--Optional:-->
<noUnite>123</noUnite>
<!--Optional:-->
<typeNomRuePtCardinal>RUE PRINCIPALE</typeNomRuePtCardinal>
<!--Optional:-->
<municipalite>QUELQUE PART</municipalite>
<!--Optional:-->
<provinceEtat>QC</provinceEtat>
<!--Optional:-->
<pays>CDA</pays>
<!--Optional:-->
<noMunicipal>555</noMunicipal>
<!--Optional:-->
<codePostal>H1H1H1</codePostal>
<!--Optional:-->
<infoCompl1>A/S MADAME TREMBLAY</infoCompl1>
<!--Optional:-->
<infoCompl2>A/S 2 </infoCompl2>
</Adresse>
<Adresse>
<referencePostal>DOMICILE-2</referencePostal>
<dateEffective>20070202</dateEffective>
<statut>V</statut>
<type>C</type>
<!--Optional:-->
<noUnite> </noUnite>
<!--Optional:-->
<typeNomRuePtCardinal>BLVD TASHEREAU</typeNomRuePtCardinal>
<!--Optional:-->
<municipalite>BROSSARD</municipalite>
<!--Optional:-->
<provinceEtat>QC</provinceEtat>
<!--Optional:-->
<pays>CDA</pays>
<!--Optional:-->
<noMunicipal>12345</noMunicipal>
<!--Optional:-->
<codePostal>J4A3A3</codePostal>
<!--Optional:-->
<infoCompl1>A/S MADAME INFOCOMPL1</infoCompl1>
<!--Optional:-->
<infoCompl2>A/S COMPL2 </infoCompl2>
</Adresse>
<Adresse>
<referencePostal>BUREAU</referencePostal>
<dateEffective>20070202</dateEffective>
<statut>V</statut>
<type>C</type>
<!--Optional:-->
<noUnite> </noUnite>
<!--Optional:-->
<typeNomRuePtCardinal>BLVD TASHEREAU</typeNomRuePtCardinal>
<!--Optional:-->
<municipalite>BROSSARD</municipalite>
<!--Optional:-->
<provinceEtat>QC</provinceEtat>
<!--Optional:-->
<pays>CDA</pays>
<!--Optional:-->
<noMunicipal>12345</noMunicipal>
<!--Optional:-->
<codePostal>J4A3A3</codePostal>
</Adresse>
<Adresse>
<referencePostal>CORRESPOND</referencePostal>
<dateEffective>20070202</dateEffective>
<statut>V</statut>
<type>C</type>
<!--Optional:-->
<noUnite> </noUnite>
<!--Optional:-->
<typeNomRuePtCardinal>BLVD TASHEREAU</typeNomRuePtCardinal>
<!--Optional:-->
<municipalite>BROSSARD</municipalite>
<!--Optional:-->
<provinceEtat>QC</provinceEtat>
<!--Optional:-->
<pays>CDA</pays>
<!--Optional:-->
<noMunicipal>12345</noMunicipal>
<!--Optional:-->
<codePostal>J4A3A3</codePostal>
<!--Optional:-->
<infoCompl1>A/S MADAME INFOCOMPL1</infoCompl1>
</Adresse>
<Adresse>
<referencePostal>EMAIL</referencePostal>
<dateEffective>20070202</dateEffective>
<statut>V</statut>
<type>E</type>
<!--Optional:-->
<adresseCourriel>TEST CLIENT@QC.CROIXBLEUE.CA</adresseCourriel>
</Adresse>
</adresseClient>
<!--Optional:-->
<telephoneClient>
<!--Optional:-->
<Telephone>
<reference>DOMICILE-1</reference>
<numeroTelephone>5148885555</numeroTelephone>
<statut>V</statut>
<dateEffective>20070101</dateEffective>
</Telephone>
<Telephone>
<reference>DOMICILE-2</reference>
<numeroTelephone>5148885555</numeroTelephone>
<statut>V</statut>
<dateEffective>20070101</dateEffective>
</Telephone>
<Telephone>
<reference>BUREAU-1</reference>
<numeroTelephone>5148885555</numeroTelephone>
<!--Optional:-->
<poste>4501</poste>
<statut>V</statut>
<dateEffective>20070101</dateEffective>
</Telephone>
<Telephone>
<reference>BUREAU-2</reference>
<numeroTelephone>5148885555</numeroTelephone>
<!--Optional:-->
<poste>12</poste>
<statut>V</statut>
<dateEffective>20070101</dateEffective>
</Telephone>
<Telephone>
<reference>TELECOPI-1</reference>
<numeroTelephone>5148885555</numeroTelephone>
<statut>V</statut>
<dateEffective>20070101</dateEffective>
</Telephone>
<Telephone>
<reference>TELECOPI-2</reference>
<numeroTelephone>5148885555</numeroTelephone>
<statut>V</statut>
<dateEffective>20070101</dateEffective>
</Telephone>
<Telephone>
<reference>CELLULAR-1</reference>
<numeroTelephone>5148885555</numeroTelephone>
<statut>V</statut>
<dateEffective>20070101</dateEffective>
</Telephone>
<Telephone>
<reference>CELLULAR-2</reference>
<numeroTelephone>5148885555</numeroTelephone>
<statut>V</statut>
<dateEffective>20070101</dateEffective>
</Telephone>
<Telephone>
<reference>CORRESP-1</reference>
<numeroTelephone>5148885555</numeroTelephone>
<statut>V</statut>
<dateEffective>20070101</dateEffective>
</Telephone>
<Telephone>
<reference>CORRESP-2</reference>
<numeroTelephone>5148885555</numeroTelephone>
<statut>V</statut>
<dateEffective>20070101</dateEffective>
</Telephone>
<Telephone>
<reference>ALPHAPAGE</reference>
<numeroTelephone>5148885555</numeroTelephone>
<statut>V</statut>
<dateEffective>20070101</dateEffective>
</Telephone>
</telephoneClient>
<!--Optional:-->
<alarme>
<dateTerminaison>20150715</dateTerminaison>
</alarme>
<!--Optional:-->
<commentaire>
<!--0 to 99 repetitions:-->
<Commentaire>
<noSequenceCommentaire>01</noSequenceCommentaire>
<commentaires>LIGNE COMMENTAIRE 1</commentaires>
</Commentaire>
<Commentaire>
<noSequenceCommentaire>02</noSequenceCommentaire>
<commentaires>LIGNE COMMENTAIRE 2</commentaires>
</Commentaire>
<Commentaire>
<noSequenceCommentaire>03</noSequenceCommentaire>
<commentaires>LIGNE COMMENTAIRE 3</commentaires>
</Commentaire>
<Commentaire>
<noSequenceCommentaire>04</noSequenceCommentaire>
<commentaires>LIGNE COMMENTAIRE 4</commentaires>
</Commentaire>
<Commentaire>
<noSequenceCommentaire>05</noSequenceCommentaire>
<commentaires>LIGNE COMMENTAIRE 5</commentaires>
</Commentaire>
<Commentaire>
<noSequenceCommentaire>06</noSequenceCommentaire>
<commentaires>LIGNE COMMENTAIRE 6</commentaires>
</Commentaire>
<Commentaire>
<noSequenceCommentaire>07</noSequenceCommentaire>
<commentaires>LIGNE COMMENTAIRE 7</commentaires>
</Commentaire>
<Commentaire>
<noSequenceCommentaire>08</noSequenceCommentaire>
<commentaires>LIGNE COMMENTAIRE 8</commentaires>
</Commentaire>
<Commentaire>
<noSequenceCommentaire>09</noSequenceCommentaire>
<commentaires>LIGNE COMMENTAIRE 9</commentaires>
</Commentaire>
<Commentaire>
<noSequenceCommentaire>10</noSequenceCommentaire>
<commentaires>LIGNE COMMENTAIRE 10</commentaires>
</Commentaire>
</commentaire>
</p1c:INP2-CLA>
</p1c:creationClient>
</soapenv:Body>
</soapenv:Envelope>
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!