开发者

Generate java classes for http service

We are trying to connect to:

http://resellertest.enom.com/interface.asp?command=nameofcommand&uid=yourloginid&pw=yourpassword&paramname=paramvalue&nextparamname=nextparamvalue
开发者_StackOverflow

Where we need to append parameters to http url and the response from the site is xml.

Sample xml response:

<?xml version="1.0" ?>
<interface-response>
<Contact>
<RegistrantPartyID>{FFD61956-8D43-45FB-BC38-E0EE23331503}</RegistrantPartyID>
</Contact>
<Command>ADDCONTACT</Command>
<Language>en</Language>
<IsLockable>True</IsLockable>
<IsRealTimeTLD>True</IsRealTimeTLD>
<TimeDifference>+03.00</TimeDifference>
<ExecTime>0.3164063</ExecTime>
<Done>true</Done>
<debug>
<![CDATA [ ] ]>
</debug>
</interface-response>

We are trying to connect to these services from java. Is there is a way that we can auto generate java classes (corresponding to xml) as we do in traditional webservices?

Thank you in advance.


If you want to populate XML data into Java objects using an XML schema, you could try Apache XmlBeans or JAXB. It depends whether you expect an XML Schema/DTD/RelaxNG/... structure. You could try Relaxer for RelaxNG (I think there are documents in English within the zip file, unless you can read Japanese).

(As a side note, I'm not sure if the service for the URL you've cited in your example is under your control, but putting the password in the URL with uid=yourloginid&pw=yourpassword doesn't seem to be a good idea.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜