ここに私が得たものがあります:SOA Suite 11gをインストールして構成しました(weblogicサーバー10.3、リポジトリ作成ユーティリティ、soaスイート、jdeveloperスタジオ、Oracle XEデータベース10g)。
SOA インフラストラクチャ サービス エンジン (BPEL、メディエータ、ビジネス ルール、Himan ワークフロー メタデータストア (MDS) エンタープライズ マネージャ、Web サービス マネージャ、B2B、アダプタフレームワーク (JCA) Oracle ビジネス アクティビティ監視 (BAM)
すべてのセットアップと実行。チュートリアル プロジェクトの Purchase Order Processing もセットアップして実行しています (「Oracle SOA suite 11g R1 A ハンズオン チュートリアルの開始」という本から)。
テストは問題なく実行されており、すべて合格しています (数種類のクレジット カード、小規模、中規模、大規模の注文、自動承認と手動承認、注文のサイズに応じて自動的に選択された出荷のいくつかの種類など)。
私が今欲しいのは、palin JAVA アプリケーションからそのサービスを接続 (消費) することです。このチュートリアル ( http://theopentutorials.com/examples/java-ee/jax-ws/create-and-consume-web-service-using-jax-ws/ ) に従って、「wsimport」という JAX-WS ツールを使用しました。 Web サービスの作成と使用に必要なアーティファクトを生成するため。「wsimport」は wsdl ファイルを入力として受け取ります。重要ではないと私が思うことについての1つの警告を除いて、それはうまくコンパイルされました(または多分そうですか?)
C:\Users\Nenad\eclipseJunoSESR2\GettingStartedWithEclipseJuno\SOAConsume02>wsimport -s src -d bin http://i3770k.mshome.net:8001/soa-infra/services/default/POProcessing/receivePO?WSDL
WSDL を解析しています...
[警告] R2716 WSI-BasicProfile ver. 1.0、soapbind:body の doc/lit で使用できない名前空間属性: http://i3770k.mshome.net:8001/soa-infra/services/default/POProcessing/receivePO?WSDLの 31 行目の「実行」
コードを生成しています... コードをコンパイルしています...
C:\Users\Nenad\eclipseJunoSESR2\GettingStartedWithEclipseJuno\SOAConsume02>
したがって、クラスは次のとおりです。
「注文」を送信する方法、つまり入力引数を設定する方法がわからないため、今は行き詰まっています。
request PurchaseOrderType * CustID string Value * ID string Value productName string itemType string price 10 進数量 10 進ステータス string ccType string ccNumber
Eclipse では、次のような SOAClient クラスを作成しました。
package com.oracle.client;
import java.math.BigDecimal;
import com.oracle.sca.soapservice.poprocessing.poprocessing.receivepo.ReceivePO;
import com.oracle.xmlns.ns.order.PurchaseOrderType;
public class SOAClient {
public static void main(String[] args) {
ReceivePO receivePO = new ReceivePO();
PurchaseOrderType pot = new PurchaseOrderType();
pot.setCustID("1111");
pot.setID("2121");
pot.setProductName("Bluetooth Headset");
pot.setItemType("Electronics");
BigDecimal bd_p = new BigDecimal("49.99");
pot.setPrice(bd_p);
BigDecimal bd_q = new BigDecimal("1000");
pot.setQuantity(bd_q);
pot.setStatus("initial");
pot.setCcType("Mastercard");
pot.setCcNumber("8765-8765-8765-8765");
}
}
自動生成されたクラス ExecutePtt は次のようになります。
package com.oracle.sca.soapservice.poprocessing.poprocessing.receivepo;
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
import com.oracle.xmlns.ns.order.ObjectFactory;
import com.oracle.xmlns.ns.order.PurchaseOrderType;
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.1.6 in JDK 6
* Generated source version: 2.1
*
*/
@WebService(name = "execute_ptt", targetNamespace = "http://oracle.com/sca/soapservice/POProcessing/POProcessing/receivePO")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@XmlSeeAlso({
ObjectFactory.class
})
public interface ExecutePtt {
/**
*
* @param request
*/
@WebMethod(action = "execute")
@Oneway
public void execute(
@WebParam(name = "PurchaseOrder", targetNamespace = "http://xmlns.oracle.com/ns/order", partName = "request")
PurchaseOrderType request);
}
ReceivePO クラスは次のとおりです。
package com.oracle.sca.soapservice.poprocessing.poprocessing.receivepo;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Logger;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.1.6 in JDK 6
* Generated source version: 2.1
*
*/
@WebServiceClient(name = "receivePO", targetNamespace = "http://oracle.com/sca/soapservice/POProcessing/POProcessing/receivePO", wsdlLocation = "http://i3770k.mshome.net:8001/soa-infra/services/default/POProcessing/receivePO?WSDL")
public class ReceivePO
extends Service
{
private final static URL RECEIVEPO_WSDL_LOCATION;
private final static Logger logger = Logger.getLogger(com.oracle.sca.soapservice.poprocessing.poprocessing.receivepo.ReceivePO.class.getName());
static {
URL url = null;
try {
URL baseUrl;
baseUrl = com.oracle.sca.soapservice.poprocessing.poprocessing.receivepo.ReceivePO.class.getResource(".");
url = new URL(baseUrl, "http://i3770k.mshome.net:8001/soa-infra/services/default/POProcessing/receivePO?WSDL");
} catch (MalformedURLException e) {
logger.warning("Failed to create URL for the wsdl Location: 'http://i3770k.mshome.net:8001/soa-infra/services/default/POProcessing/receivePO?WSDL', retrying as a local file");
logger.warning(e.getMessage());
}
RECEIVEPO_WSDL_LOCATION = url;
}
public ReceivePO(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
public ReceivePO() {
super(RECEIVEPO_WSDL_LOCATION, new QName("http://oracle.com/sca/soapservice/POProcessing/POProcessing/receivePO", "receivePO"));
}
/**
*
* @return
* returns ExecutePtt
*/
@WebEndpoint(name = "execute_pt")
public ExecutePtt getExecutePt() {
return super.getPort(new QName("http://oracle.com/sca/soapservice/POProcessing/POProcessing/receivePO", "execute_pt"), ExecutePtt.class);
}
/**
*
* @param features
* A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values.
* @return
* returns ExecutePtt
*/
@WebEndpoint(name = "execute_pt")
public ExecutePtt getExecutePt(WebServiceFeature... features) {
return super.getPort(new QName("http://oracle.com/sca/soapservice/POProcessing/POProcessing/receivePO", "execute_pt"), ExecutePtt.class, features);
}
}
ObjectFactory クラスは次のとおりです。
package com.oracle.xmlns.ns.order;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the com.oracle.xmlns.ns.order package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
private final static QName _PurchaseOrder_QNAME = new QName("http://xmlns.oracle.com/ns/order", "PurchaseOrder");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.oracle.xmlns.ns.order
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link PurchaseOrderType }
*
*/
public PurchaseOrderType createPurchaseOrderType() {
return new PurchaseOrderType();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link PurchaseOrderType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://xmlns.oracle.com/ns/order", name = "PurchaseOrder")
public JAXBElement<PurchaseOrderType> createPurchaseOrder(PurchaseOrderType value) {
return new JAXBElement<PurchaseOrderType>(_PurchaseOrder_QNAME, PurchaseOrderType.class, null, value);
}
}
パッケージ情報は
@javax.xml.bind.annotation.XmlSchema(namespace = "http://xmlns.oracle.com/ns/order", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package com.oracle.xmlns.ns.order;
と
PurchaseOrderType クラスは
package com.oracle.xmlns.ns.order;
import java.math.BigDecimal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for PurchaseOrderType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="PurchaseOrderType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="CustID" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="ID" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="productName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="itemType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="price" type="{http://www.w3.org/2001/XMLSchema}decimal" minOccurs="0"/>
* <element name="quantity" type="{http://www.w3.org/2001/XMLSchema}decimal" minOccurs="0"/>
* <element name="status" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="ccType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="ccNumber" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PurchaseOrderType", propOrder = {
"custID",
"id",
"productName",
"itemType",
"price",
"quantity",
"status",
"ccType",
"ccNumber"
})
public class PurchaseOrderType {
@XmlElement(name = "CustID", required = true)
protected String custID;
@XmlElement(name = "ID", required = true)
protected String id;
protected String productName;
protected String itemType;
protected BigDecimal price;
protected BigDecimal quantity;
protected String status;
protected String ccType;
protected String ccNumber;
/**
* Gets the value of the custID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCustID() {
return custID;
}
/**
* Sets the value of the custID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCustID(String value) {
this.custID = value;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getID() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setID(String value) {
this.id = value;
}
/**
* Gets the value of the productName property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getProductName() {
return productName;
}
/**
* Sets the value of the productName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setProductName(String value) {
this.productName = value;
}
/**
* Gets the value of the itemType property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getItemType() {
return itemType;
}
/**
* Sets the value of the itemType property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setItemType(String value) {
this.itemType = value;
}
/**
* Gets the value of the price property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getPrice() {
return price;
}
/**
* Sets the value of the price property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setPrice(BigDecimal value) {
this.price = value;
}
/**
* Gets the value of the quantity property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getQuantity() {
return quantity;
}
/**
* Sets the value of the quantity property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setQuantity(BigDecimal value) {
this.quantity = value;
}
/**
* Gets the value of the status property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getStatus() {
return status;
}
/**
* Sets the value of the status property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setStatus(String value) {
this.status = value;
}
/**
* Gets the value of the ccType property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCcType() {
return ccType;
}
/**
* Sets the value of the ccType property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCcType(String value) {
this.ccType = value;
}
/**
* Gets the value of the ccNumber property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCcNumber() {
return ccNumber;
}
/**
* Sets the value of the ccNumber property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCcNumber(String value) {
this.ccNumber = value;
}
}
したがって、私の質問は次のとおりです。
これを機能させるには、クラス SOAClient に何を追加する必要がありますか (パラメーターを設定し、テストを実行して注文します)。
そもそもJAX-WSを使用する必要がありますか? それなしでいくつかのチュートリアルを見たので、私は尋ねますが、まだそれらを勉強していません.