简体   繁体   English

如何为提供的WSDL编辑Java类

[英]How to edit Java class for WSDL provided

I am working on a java program to call a Oracle Webservice in loop to create some data. 我正在研究一个Java程序,以循环调用Oracle Webservice来创建一些数据。 But I have been told to use different XML tags that the ones that are provided on the WSDL. 但是我被告知要使用与WSDL上提供的XML标签不同的XML标签。 So far, I have found no problems with this, since I learnt to "import" the WSDL url and create the java classes from it. 到目前为止,我没有发现任何问题,因为我学会了“导入” WSDL URL并从中创建Java类。 But now, I face a problem that I don't know how to 但是现在,我遇到了一个我不知道该怎么做的问题

So far, I have found no problems with this, since I learnt to "import" the WSDL url and create the java classes from it. 到目前为止,我没有发现任何问题,因为我学会了“导入” WSDL URL并从中创建Java类。 But now, I face a problem that I don't know how to create this new tags on the Java classes, or even of this will work. 但是现在,我遇到了一个问题,我不知道如何在Java类上创建这个新标签,或者甚至可以使用。

     <com:StandardReceiptFLEXVA>
           <!--Optional:-->
           <stan:CashReceiptId>?</stan:CashReceiptId>
           <!--Optional:-->
           <stan:__FLEX_Context>?</stan:__FLEX_Context>
           <!--Optional:-->
           <stan:__FLEX_Context_DisplayValue>? 
           </stan:__FLEX_Context_DisplayValue>
           <!--Optional:-->
           <stan:_FLEX_NumOfSegments>?</stan:_FLEX_NumOfSegments>
        </com:StandardReceiptFLEXVA>

This is the standard code that SOAPUI generates when I give the WSDL url. 这是我提供WSDL URL时SOAPUI生成的标准代码。 But Oracle support team (which I have contacted previously) have told me that I need to use this: 但是Oracle支持团队(我之前已经联系过)告诉我,我需要使用以下代码:

<com:StandardReceiptFLEXVA xsi:type="stan:Fianzas" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

           <stan:__FLEX_Context>FEE</stan:__FLEX_Context>
       <stan:modalidad>Provisional</stan:modalidad>
       <stan:tipoFianza>CASH</stan:tipoFianza>
       <stan:actividadConApbc>Test</stan:actividadConApbc>
           <stan:numReferenciaMigracion>99</stan:numReferenciaMigracion>


        </com:StandardReceiptFLEXVA>  

That Works on SOAPUI, but when I go to my Java class, the are no set/get but the "standard" ones.. So I thought I should edit the java class and add these. 可以在SOAPUI上工作,但是当我进入Java类时,除了“标准”类之外,其他不是set / get。所以我认为我应该编辑Java类并添加它们。 But I don't know how to specify the xsi:type="stan:Fianzas" attribute on Java. 但是我不知道如何在Java上指定xsi:type =“ stan:Fianzas”属性。 I hope I managed to explained myself correctly, since I am not an English speaker. 我希望我能正确地解释自己,因为我不会说英语。 Thank you in advance. 先感谢您。

Since your new WSDL file is working fine in SoapUI, then now you new to ( re-generate ) the java client code from the new updated WSDL file. 由于新的WSDL文件在SoapUI中可以正常工作,因此现在您可以从新的更新的WSDL文件中重新生成 Java客户端代码( 重新生成 )。

You can achieve that in SoapUI itself by following the instructions given in below links. 您可以按照以下链接中给出的说明,在SoapUI本身中实现该目标。 It basically shows you how you can use different code generation tools like Axis 1.X, Axis 2, CXF 2.X, and .NET 2.0 to generate client code. 它基本说明了如何使用不同的代码生成工具(例如Axis 1.X,Axis 2,CXF 2.X和.NET 2.0)生成客户端代码。

SOAP Code Generation SOAP代码生成

Generating Client JAVA code for WSDL using SOAP UI 使用SOAP UI为WSDL生成客户端JAVA代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM