Hi Gabo
Hi Sergey,
Thanks too! 2.2.4 then?
Yeah, as far as the introspection of package-info.java is concerned. If you don't have many JAXB classes then simply add a namespace
to @XmlRootElements....If you really need it right now then you might want to register a custom WADLGenerator by copying the code
from the trunk, as a provider....
cheers, Sergey
Also, to answer your question, this is the annotation used in the package-info
class:
@javax.xml.bind.annotation.XmlSchema(namespace = "http://domain.some/",
elementFormDefault =
javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
I just took this from the samples/user's guide.
Gabo
Sergey Beryozkin wrote:
Hi Gabo
I've just got it fixed. WADLgenerator will now introspect package-info.java
in cases when @XmlRootElement has only a local name set and if the namespace
is available then the resulting WADL will correctly link to a generated
schema element....
thanks for raising this issue
Sergey
Sergey Beryozkin wrote:
Hi Gabo
MyObject has @XmlRootElement with only a local name specified. Does
package-info.java has a namespace specified too, in addition to the local
name ?
cheers, Sergey
Gabo Manuel wrote:
Hi Sergey,
I am a bit confused. How do I supply the namespace needed? I thought the
package-info.java would be enough.
Yes, for now I would be limiting the consume to just text/xml. The initial intent was to take advantage of CXF's handling
between xml and json. But for now, we would be sticking to text/xml.
Gabo
Sergey Beryozkin wrote:
Hi Gabo
thanks... The reason you only see the '<representation/>' for my MyObject is
that
there's no namespace available , so even though the <grammars/> section
has
the schema embedded there's no way to link to it from the
<representation/>.
May be I should have some XML comment generated which will advise to
check
the schema (with no namespace) ?
You might also want to update Consumes("*/*") to require a more specific
media type.
I haven't tried it lately without the providers, but are primitives now
supported out of the box?
They are but only for text/plain. I'll add a task to wrap them in some
tag
like <response> for xml media types
Also, is there somewhere to look to be able to use the tool that
creates
an http-centric client-code from the wadl?
No, I haven't started working on the code gen tool yet....But it's on
the
map
cheers, Sergey
Gabo Manuel wrote:
Hi Sergey,
Sorry for the late response. I may have misrepresented the method, it should be
as follows:
@WebService(name="MyObjectService")
@SOAPBinding(use=Use.LITERAL, style=Style.RPC)
@Consumes("*/*")
@Produces("text/xml")
@Path("/MyObjects")
public interface MyObjectService{
@GET
@Path("/")
@WebMethod
@WebResult(name="myObjectInstance")
public MyObject getMyObject(
@QueryParam("uniqueIDField")
@WebParam(name="uniqueIDField")
long uniqueIDField)
;
@PUT
@Path("/")
@WebMethod
@WebResult(name="uniqueIDField")
public long insertMyObject(
@WebParam(name="myObjectInstance")
MyObject myObjectInstance,
@QueryParam("reason")
@WebParam(name="reason")
String reason
)
;
}
@WebService(endpointInterface="some.domain.MyObjectService",
serviceName="MyObjectService", portName="MyObjectServicePort")
public class MyObjectServiceImpl implements MyObjectService{
public MyObject getMyObject(long uniqueIDField) throws
SolegyContingencyException{
return new MyObject();
}
public long insertMyObject(MyObject myObjectInstance, String
reason) throws SolegyContingencyException{
return 1;
}
}
@XmlType(name="MyObject")
@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlRootElement(name="MyObject")
public class MyObject {
private long uniqueIDField;
@GET
@Path("/uniqueIDField")
public long getUniqueIDField() {
return uniqueIDField;
}
public void setUniqueIDField(long uniqueIDField) {
this.uniqueIDField = uniqueIDField;
}
}
The wadl section i get is something as follows:
<method name="GET">
<request>
</request>
<response>
<representation mediaType="text/xml"/>
</response>
</method>
<method name="PUT">
<request>
<representation/>
</request>
<response>
<!-- Primitive type : xs:long --><representation
mediaType="text/xml"/>
</response>
</method>
And yes, I did specify text/xml. I also have providers included to wrap the response in tags. I had to add the providers
because at the time (2.0), primitives were not supported. I haven't tried it lately without the providers, but are primitives
now supported out of the box?
Also, is there somewhere to look to be able to use the tool that
creates an http-centric client-code from the wadl?
Thanks!
Gabo.
Sergey Beryozkin wrote:
Hi Gabo
It is an 'Object' so a WSDL generator has no idea what else to say,
apart
from <representation/>. If you add "Consumes' with some values then
you'll
get a bit more specific tag...
However, there appears to be a bug :
<response><!-- Primitive type : xs:long --><representation
mediaType="text/xml"/></response></method></resource>
or do you have Produces('text/xml') on the class itself ? Can you
please
send me a class sample so that I can fix it ?
cheers, Sergey
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.5.409 / Virus Database: 270.13.62/2315
- Release Date:
08/20/09 06:05:00
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.5.409 / Virus Database: 270.13.65/2323
- Release Date: 08/24/09 06:05:00