On Wednesday 03 September 2008 5:15:29 pm [EMAIL PROTECTED] wrote:
> Hi,
>
> my web service is up and running and now the other developer starts to use
> it in his PHP project. It worked fine on local copies, but it behaves
> strange on live server :-( Suddenly I receive all parameters as "" instead
> of NULL, when not specified on PHP side.
>
> I started implementation from java interface:
>     public void registerUser(@WebParam(name = "login") String login,
> @WebParam(name = "password") String password, @WebParam(name = "openId")
> String openId, @WebParam(name = "name") String name, @WebParam(name =
> "portal") String portal, @WebParam(name = "portalPassword") String
> portalPassword) throws DuplicateKeyException, InvalidInputException,
> AccessDeniedException, LdapException;
>
> And here you can see generated WSDL:
> http://www.abclinuxu.cz/services/users?wsdl <xs:complexType
> name="registerUser">
> <xs:sequence>
> <xs:element minOccurs="0" name="login" type="xs:string"/>
> <xs:element minOccurs="0" name="password" type="xs:string"/>
> <xs:element minOccurs="0" name="openId" type="xs:string"/>
> <xs:element minOccurs="0" name="name" type="xs:string"/>
> <xs:element minOccurs="0" name="portal" type="xs:string"/>
> <xs:element minOccurs="0" name="portalPassword" type="xs:string"/>
> </xs:sequence>
>
> 1) How can I influence this WSDL? For example I want to specify minOccurs=1
> to make login and password mandatory, but nillable=true for openid.

The only way to do this with JAX-WS is to generate a wrapper bean and modify 
the annotations on the wrapper bean to add the required/nillable attributes 
to the XmlElement annotations.

You can us the java2ws -wrapperbean tool to create a first pass at the beans.   

>
> 2) Do you know, why CXF sends "" instead of NULL? 

If there is an element in the soap message, it will be "".   For null, the 
element should be eliminated.  (example: no openID element at all in the 
message)


Dan

> This is in SOAP body 
> (different method):
>
> <ns1:updateUser><acount><city/><country/><deliveryAddressCity/><deliveryAdd
>ressCountry>null</deliveryAddressCountry><deliveryAddressName/><deliveryAddr
>essStreet/><deliveryAddressZIP/><emailAddress>[EMAIL PROTECTED]</emailAd
>dress><emailBlocked/><emailVerified/><forgottenPasswordToken/><homepageURL/>
><invoicingAddressCity>Praha
> 3</invoicingAddressCity><invoicingAddressCountry>ceska
> republika</invoicingAddressCountry><invoicingAddressName/><invoicingAddress
>Street>Konevova </invoicingAddressStreet><invoicingAddressZIP>130
> 83</invoicingAddressZIP><invoicingCompany/><invoicingCompanyDIC/><invoicing
>CompanyICO/><lastLoginDate/><login>literakl2</login><name>Leos
> Literak</name><openID/><passwordAnswer/><passwordHash/><passwordQuestion/><
>phone/><registrationDate/><sex/><userPassword/></acount><portal>secret/porta
>l><portalPassword>secret</portalPassword></ns1:updateUser>
>
> The developer tried to modify this SOAP message and sent <openID
> xsi:nil="true" /> but CXF though translated it into "" parameter.
>
> I use CXF 2.0.5 in jetty 6.1.11, no spring, deploy the service with:
>         Endpoint.publish(endpointUrlServices, new
> UserAccountServiceImpl());
>
> public class AbcCxfServlet extends CXFNonSpringServlet {
>     public void init(ServletConfig servletConfig) throws ServletException {
>         super.init(servletConfig);
>         Bus bus = this.getBus();
>         BusFactory.setDefaultBus(bus);
>     }
> }
>
> Any help will be appreciated.
>
> Leos



-- 
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog

Reply via email to