Discussions
Categories
- 197.1K All Categories
- 2.5K Data
- 546 Big Data Appliance
- 1.9K Data Science
- 450.7K Databases
- 221.9K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 552 MySQL Community Space
- 479 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3.1K ORDS, SODA & JSON in the Database
- 555 SQLcl
- 4K SQL Developer Data Modeler
- 187.2K SQL & PL/SQL
- 21.3K SQL Developer
- 296.3K Development
- 17 Developer Projects
- 139 Programming Languages
- 293K Development Tools
- 109 DevOps
- 3.1K QA/Testing
- 646.1K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 158 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.2K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 19 Java Essentials
- 162 Java 8 Questions
- 86K Java Programming
- 81 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 204 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 466 LiveLabs
- 39 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 175 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 233 Portuguese
Web Service with complex data types

Hi,
I would like to get some guidance for the following issues that i have. I need to create a web service(not consume) from a WSDL file that needs to replace another web service. So the structure of the requests and the responses needs to stay the same so the applications that consume the web services wont have to make changes. So I have 2 possible solutions and i would like to hear from you if you have any other recommendations:
1. Enable AM custom method as a service, but the problem here is that I can only use primitive types for parameters and return parameters while in the WS definition i have complex types both for parameters and return types.
2. Creating the WS from WSDL(the automatic option of jDeveloper to create the WS classes). This option works fine but the issue here is that i would like to use ADF business components for CRUD operations. Any idea how can i achieve that?
If you need anymore info please let me know.
Currently on 11.1.2.4 but we are migrating to 12.2.1.3 this month.
Thanks
Answers
-
create a web service(not consume) from a WSDL file that needs to replace another web service.
The web service methods including return types and request parameters and parameter types would need to be the same for web service consumers to not require any modifications. What needs to be different that a new web service is required?
-
The thing that needs to be different is the entity that provides the web services. We are developing software for a company that used some other software until now and they have clients that use their own applications and use this web service to upload data to our system and they don't want to modify their application.
-
The only feature that needs to be different is the web service URL which is specified in the location element,
which could be before:
<definitions
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:y="http://webservice.example/entity1"
xmlns:ns="http://http://webservice.example/entity1/types/"
targetNamespace="http://http://webservice.example/entity1/"
>
...
<service name="Entity1Service">
<port name="Entity1Endpoint" binding="y:Entity1SoapHttpBinding">
<soap:address
location="http://localhost/entity1/entity1.asmx"/>
</port>
</service>
</definitions>
And after modification:
<definitions
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:y="http://webservice.example/entity2"
xmlns:ns="http://http://webservice.example/entity2/types/"
targetNamespace="http://http://webservice.example/entity2/"
>
...
<service name="Entity2Service">
<port name="Entity2Endpoint" binding="y:Entity2SoapHttpBinding">
<soap:address
location="http://localhost/entity2/entity2.asmx"/>
</port>
</service>
</definitions>
-
Thanks for the reply but that is not what I'm after. Please refer to points 1 and 2 in the original post. I need to recreate the whole web service and the only thing i have is the WSDL.
-
Hi,
You can use ADF-BC to expose your CRUD operations. For that cases you have non primitive types (probably because you are creating) your class needs to implement oracle.jbo.AttributeList. Imagine you have MyClass.java with two attributes "firstName" and "lastName". You would have as follows:
public class MyClass implements java.io.Serializable, oracle.jbo.AttributeList {
private String firstName;
private String lastName;
public InitiatedProcess() {}
public Object getAttribute(int i) {
if(i == 0){
return firstName;
} else {
return lastName;
}
}
public Object getAttribute(String string) {
if (string.toLowerCase().equals("firstName")) {
return firstName;
} else {
return lastName;
}
}
public void setAttribute(int i, Object object) {
if (i == 0) {
firstName = object.toString();
} else {
lastName= object.toString();
}
}
public void setAttribute(String string, Object object) {
if (string.toLowerCase().equals("tasknumber")) {
firstName= object.toString();
} else {
lastName= object.toString();
}
}
public int getAttributeCount() {
return 2;
}
public int getAttributeIndexOf(String string) {
if (string.toLowerCase().equals("firstName")) {
return 0;
} else {
return 1;
}
}
public String[] getAttributeNames() {
return new String[] { "firstName", "lastName" };
}
public Object[] getAttributeValues() {
return new Object[] {firstName, lastName};
}
}
After doing this you are able to expose the method on Application Module that uses this class.
Best Regards,
Pedro Gabriel
-
So you are saying that if i implement oracle.jbo.AttributeList in MyClass i can use it as input and return parameter in my Application Module method for example:
public MyClass registerData(MyClass2 myParam){
...
}
and expose this as a web service?
-
Hi,
Yes your MyClass must implement oracle.jbo.AttributeList and override the methods I previous detailed. I have already implemented it in one of my projects.
Best Regards,
Pedro Gabriel
-
Ok thanks. i'll try it first thing in the morning and will let you know how it goes.
-
1. Modify the WSDL for the new "Entity".
2. Generate a Web Service from the WSDL
JDeveloper has the provision to automatically generate a Web service from a WSDL.
-
I tried it. I set MyClass as a return type for my Service method but when creating the service interface i needed to provide a return parameter of type ViewObject for this method. I created programmatic view object with the same attributes as MyClass. Is that the right approach for this?