English 中文(简体)
需要帮助编写从XML到服务器数据库(详情)
原标题:Need help with writing from XML to a SQL Server database (detailed)

我用XML和网络服务等新东西 m。

I m利用玻璃天花开放式ESB开展一个项目,计划从网络服务获取某些信息,然后储存在数据库中。

基本标准是,我必须使用玻璃天花板的开放式ESB或EJB模块,在这种模块中,我可以发现网络服务或与这些线路相类似的东西,而且我必须使用2005年KQ服务器。

到目前为止,我已经与网络服务机构进行了交谈:并收到内容大致如此的内容。

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Body>
    <m:entrypoint_getSettlementsOperationResponse xmlns:m="http://j2ee.netbeans.org/wsdl/BorgunTestBPEL/entrypoint_getSettlements">
      <part1>
        <GetSettlementsByMerchantResponse xmlns="http://Borgun.Services.Gateway/2010/04/Settlement">
          <GetSettlementsByMerchantResult xmlns:a="http://schemas.datacontract.org/2004/07/Borgun.Library.Common" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:msgns="http://Borgun.Services.Gateway/2010/04/Settlement" xmlns:ns0="http://j2ee.netbeans.org/wsdl/BorgunTestBPEL/entrypoint_getSettlements">
            <a:CreditCardSettlement>
              <a:amexAmount>XXX</a:amexAmount>
              <a:amount>XXXX</a:amount>
              <a:batches>
                <a:CreditCardBatch>
                  <a:batchdate>xxx</a:batchdate>
                  <a:batchnumber>XXXX</a:batchnumber>
                  <a:currencyCode>xxxx</a:currencyCode>
                  <a:merchantnumber>xxxx</a:merchantnumber>
                  <a:settlementRunNumber>xx4</a:settlementRunNumber>
                  <a:settlementdate>2010-04-06T00:00:00</a:settlementdate>
                  <a:slips>2</a:slips>
                  <a:sum>xxxx</a:sum>
                </a:CreditCardBatch>
                <a:CreditCardBatch>
                  <a:batchdate>xxx</a:batchdate>
                  <a:batchnumber>xxxxx</a:batchnumber>
                  <a:currencyCode>xxxx</a:currencyCode>
                  <a:merchantnumber>xxxx</a:merchantnumber>
                  <a:settlementRunNumber>xxxx</a:settlementRunNumber>
                  <a:settlementdate>xxxx</a:settlementdate>
                  <a:slips>x</a:slips>
                  <a:sum>xxx</a:sum>
                </a:CreditCardBatch>
              </a:batches>
              <a:commission>xx</a:commission>
              <a:currencyCode>xxx</a:currencyCode>
              <a:deduction>-xxx</a:deduction>
              <a:deductionItems>
                <a:CrediCardSettlementDeduction>
                  <a:amount>-xxx</a:amount>
                  <a:code>VIÐSKF</a:code>
                  <a:currencyCode>ISK</a:currencyCode>
                  <a:merchantnumber>xxx</a:merchantnumber>
                  <a:settlementrunnumber>xxx</a:settlementrunnumber>
                  <a:text>Afsláttur v/ekorta</a:text>
                </a:CrediCardSettlementDeduction>
                <a:CrediCardSettlementDeduction>
                  <a:amount>-335.00</a:amount>
                  <a:code>ÁLAGKREK</a:code>
                  <a:currencyCode>ISK</a:currencyCode>
                  <a:merchantnumber>xxx</a:merchantnumber>
                  <a:settlementrunnumber>xxx</a:settlementrunnumber>
                  <a:text>xxx</a:text>
                </a:CrediCardSettlementDeduction>
              </a:deductionItems>
            </a:CreditCardSettlement>
          </GetSettlementsByMerchantResult>
        </GetSettlementsByMerchantResponse>
      </part1>
    </m:entrypoint_getSettlementsOperationResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

我可以进入SQ 2005服务器,该服务器是遥远的,而且我知道可以插入,但鉴于现在我有一对一的关系,如果情况不好,我就希望能够退缩。

因此,简言之,我如何最好在不人工穿过XML树的情况下从XML中插入行文?

我确信,Im本应能够使用实体和会议,或可能是日本宇宙航空研究开发机构具有约束力的,但Im根本不能成功。

其中一个原因可能与以下事实有关:肥皂反应包含一系列的信贷担保,其中每一种都包含一系列的 Bat和排泄系统。

如果有人能够帮助我通过玻璃天花开放式食堂的BPEL这样做,那将是最好的,但人们非常赞赏在 j办法中的任何 h。

问题回答

you will want to use JAXB. find the xjc tool in the /bin (this should be in your path already, then use it on the schema at http://schemas.xmlsoap.org/soap/envelope/. you should first download the schema, then run
xjc -d <directory> <schema-name>
the directory should be a source folder (e.g. src) and the schema-name is the filename of wherever you downloaded the schema to. this will generate a bunch of source files which correspond to the schema. you can then use the JAXB Unmarshaller tool like this:
JAXBContext ctx = JAXBContext.newInstance(Envelope.class.getPackage().getName();
Unmarshaller u = ctx.createUnmarshaller();
JAXBElement<Envelope> root = (JAXBElement<Envelope>) u.unmarshall(xmlStr);
Envelope envelope = root.getValue();

封面将代表你一定要写到的数据结构的根源(我不知道答案)。 xmlStr需要成为SantingBuffer,其中含有xml的内容。





相关问题
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 ...

热门标签