English 中文(简体)
摘自POJO
原标题:Generating SOAP XML from POJO
  • 时间:2012-01-12 11:48:48
  •  标签:
  • java
  • xml
  • soap

用于标识和变造目的的Hello需要以SOAP XML的形式储存亚洲开发银行的春天乐器投入。 你们能够帮助我,图书馆能够使用,并且你有一些法律实例,说明如何从公共汽车组织的目标中创建社会行动党。 我试图利用javax.xml.soap.* 生产SOAP Envelope, Header and Body,以及日本宇宙航空研究开发机构,从POJO生产Xml。 javax.xml.soap.* 做罚款,但与POJOxml的地名空间存在问题。 能否自动产生名称空间? 例如......

我没有名称空间的产出是

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Header/>
  <SOAP-ENV:Body>
    <z:getClientDetail xmlns:z="my.package">
    <client>
      <adresses>
        <city>Praha</city>
        <houseNumber>1455</houseNumber>
        <street>Hudeckova</street>
      </adresses>
      <adresses>
        <city>Brno</city>
        <houseNumber>44</houseNumber>
        <street>Tupolevova</street>
      </adresses>
      <firstName>Standa</firstName>
      <lastName>Vrana</lastName>
    </client>
 </z:getClientDetail>

但使用名称空间的正确产出是

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Header/>
  <SOAP-ENV:Body>
    <z:getClientDetail xmlns:z="my.package">
    <java:client xmlns:java="my.package.dto">
    <java:adresses>
      <java:city>Praha</city>
      <java:houseNumber>1455</houseNumber>
      <java:street>Hudeckova</street>
    </java:adresses>
    <java:adresses>
      <java:city>Brno</city>
      <java:houseNumber>44</houseNumber>
      <java:street>Tupolevova</street>
    </java:adresses>
    <java:firstName>Standa</firstName>
    <java:lastName>Vrana</lastName>
   </java:client>
  </z:getClientDetail>

感谢P。

问题回答

http://docs.oracle.com/javase/6/docs/api/javax/xml/bind/annotation/XmlSchema.html” rel=“nofollow”>javax.xml.bind.annotation.XmlSchema<<<>/a>. 之后,日本宇宙航空研究开发机构将在指定名称空间的附加说明的包裹中产生XML。

如果你愿意的话,也可以使用javax.xml.bind.annotation.XmlType http://docs.oracle.com/javase/6/docs/api/javax/xml/bind/annotation/XmlElement.html

为什么你想要将数据储存在非行的SOAP XML表格中?

And to create SOAP XML from POJO object, you can write manually all the static part and put all dynamic values from POJO like below. Ex:

String request = "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">  <soapenv:Header><tem:B2BCode>"+pojo.getPojoObject+"</tem:B2BCode></soapenv:Header></soapenv:Envelope>"




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签