facebook

Namespaces and java mapping in WSDL

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #592625 Reply

    madamx
    Participant

    I’m creating a WSDL with the Eclipse WSDL editor.
    I want to organize the code (generated from the wsdl) in packages.
    I saw that I can do that by adding namespaces to elements, but I’m not able to assign namespaces to types.
    I mean: I created a XSD schema, with some types that I want to share between services, for example ErrorType.
    For this file, I set as default namespace “http:// model.example.org/common”, and then I imported it into my wsdl.
    When I generate the code from the wsdl, it goes in the “model” packages, so it is the desired behaviour.
    Now I want to do the same thing, but varying packages inside the same wsdl:
    I want to assign the namespace “model.service306” to the types that I declare inside the Service306.wsdl, so they will be generated in the “model.service306” package, and so on with other services (service307, service308, etc…), and assign the namespace “business.service306” for the operations.
    How can I do this by the Eclipse WSDL editor?

    Another thing is: when I generate the code from the wsdl, it translates the xsd:date and xsd:datetime to Java Calendar class, but I want to map it to the Date class. Is it possible?

    Thank you, and sorry for my bad English.

    #592698 Reply

    support-tony
    Keymaster

    madamx,

    I’m not clear about the first part of your problem. If you have multiple WSDL files representing multiple services then you can specify a different target namespace for each WSDL and you should get the classes generated in the appropriate packages. If you are wanting to place different types in different packages then they will need to be defined in different xsd:schema elements that have the appropriate targetNameSpace attribute.

    As far as binding schema types to different Java types from those defined by the default JAXB bindings, you will need to use the techniques described in this documentation. I can give an example, though there are other methods. In the schema element, you may include something like the following:

    
       <xsd:schema targetNamespace="http://example.com/model.xsd"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
          xmlns:jxb="http://java.sun.com/xml/ns/jaxb" jxb:version="2.1">
             <xsd:annotation>
                <xsd:appinfo>
                   <jxb:globalBindings>
                      <jxb:javaType name="java.util.Date" xmlType="xsd:date"></jxb:javaType>
                   </jxb:globalBindings>
                </xsd:appinfo>
             </xsd:annotation>

    Which would generate the types in the com.example.model package and use java.util.Date as the binding to the xsd:date type.

    I’m afraid these questions are really software development questions, rather than to do with the MyEclipse tooling so we won’t be able to help further with investigating subsequent related problems but I hope this sets you on the right track.

    If you see tooling issues related to this, or any other function of MyEclipse, feel free to raise them on this forum.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Namespaces and java mapping in WSDL

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