Alpha Omega

Greenhorn
+ Follow
since Jan 09, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Alpha Omega

Wait guys....
I thought you don't need anything other than JDK 6 to implement JAX-WS. In fact, i can build a JAX-WS service and run it just by using JDK 6.
To generate client artifacts, you are good with JDK 6 too.

Only for JAX-RS you need to download its implementation (Jersey is the one i have been using from a year or so)

Well, i understand that for production ready systems you will need an application/web container but just for hands on and to understand/learn web services, i dont think we need anything special other than JDK.

Please validate as i might be wrong...

13 years ago
H Paul

Here is the result for wsimport

[ERROR] undefined simple or complex type 'soapenc:Array'

It kinda proves your point. The WSDL is JAX-RPC based and it gives error when JAX-WS based wsimport tool

What it means is JAX-RPC based ws using complex data types will not work with JAX-WS generated clients... Kinda confusing...

Cheers,
AA
13 years ago
H Paul,

Yes, what you are suggesting makes sense but only if the producer is using JAX-RPC or newer JAX-WS data types.

If the response is in simple data types, i guess it might not complain in any of the way you try to generate the client code.

I will give it a try and post the outcome sometime soon...

Here is the result for wsimport

[ERROR] undefined simple or complex type 'soapenc:Array'

It kinda proves your point. The WSDL is JAX-RPC based and it gives error when JAX-WS based wsimport tool

What it means is JAX-RPC based ws using complex data types will not work with JAX-WS generated clients... Kinda confusing...

Cheers,
AA

H Paul wrote:

In theory, theory and practice are the same. In practice, they are not.


How I do my little way:

1. Look at the WSDL schema data type: JAX-RPC and JAX-WS have some common data type. JAX-WS also support new data type which is
not supported by JAX-RPC. 1 of the link mentioned it.

2. Just do it by Nike:

I just take the wsdl and use JAX-RPC soap engine to generate the client side to see if it complain or not.
if it complain, then provider use something NON JAX-RPC.

I just take the wsdl and use JAX-WS soap engine to generate the client side to see if it complain or not.
if it complain, then provider use something NON JAX-WS.

This exercise is to validate the point 1.

13 years ago
If i were you, I would just use JAX-WS RI (Reference Implementation) which comes in built with JDK 6.

Below is some sample code from Java Webservices: Up and running book

----------- Service Endpoint Interface ---------


---- Service Implementation Bean -------------


------ Web service Publisher------------



Compile this src & run TimeServerPublisher

Open a browser & key in http://localhost:9876/ts?wsdl and there you go..

That's your first web service built and published.

You can build the client from this wsdl & invoke it like you do for any other web service.


P.S. I know i have skipped tons of details but i would suggest you to go thru Java Web Services: Up and Running book and read it thru.

This is what i am doing even tho i have some experience in building JAX-RPC based web services.

Cheers,
AA

13 years ago
Tim and James,
Thanks for clarification.

H Paul,
Yes i have gone thru the whole series of those articles.

It does explain the difference in terms of implementation and the underlying technology/transport and the specs support.

But i was not able to figure out how can we identify the implementation thru WSDL.

It does make sense when WSDL abstracts out the impl details as that is what an interface contract should be.

I just wanted to make sure i am not missing something big....

Thanks,
AA

13 years ago
I am trying to figure out how to identify if a specific web service is implemented in JAX-RPC or JAX-WS.

All i have is a wsdl.

Also, i would like to know if it matters at all from consumer perspective if it is JAX-RPC or JAX-WS based?

Thanks,
AA
13 years ago
Hello, I am having issue understanding hibernate's persistence flow for one of the sample code from Enterprise Java Beans 3 5th Edition book

I am using MySql as DB

Basically, i am trying to create a one-2-one bi directional relationship between Customer & CreditCard entities where Customer table in db will hold CreditCard's PK & vice versa.

All said & done, the db rows do not reflect this...

----------Customer Data ----------

CUSTOMER_ID,FIRST_NAME,LAST_NAME,ADDRESS_ID,CREDIT_CARD_ID
12,"first name","last name",19,4

------------- CreditCard Data-------
CREDIT_CARD_ID,EXP_DATE,NUMBER,NAME,CUSTOMER_ID
4,2011-11-09,123-456-7890,first name last name,null

As you can see CreditCard row does not hold reference key to Customer (CUSTOMER_ID is null)

Not sure why is this happening, as i understand both the db tables will hold references to each other. Or else how would it be bi directional relationship??

Thanks,
N.D.

----- Entity POJOs -------------

@Entity
@Table(name="CUSTOMER",schema="alpha")
public class Customer implements Serializable {

@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="CUSTOMER_ID")
private Long customerId;

@Column(name="FIRST_NAME")
private String firstName;

@Column(name="LAST_NAME")
private String lastName;

@OneToOne(cascade={CascadeType.ALL})
@JoinColumn(name="ADDRESS_ID")
private Address address;

@OneToOne(cascade={CascadeType.ALL})
@JoinColumn(name="CREDIT_CARD_ID")
private CreditCard creditCard;

public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public Long getCustomerId() {
return customerId;
}
public CreditCard getCreditCard() {
return creditCard;
}
public void setCreditCard(CreditCard creditCard) {
this.creditCard = creditCard;
}
}

@Entity
@Table(name="CREDIT_CARD",schema="alpha")
public class CreditCard implements Serializable {

@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="CREDIT_CARD_ID")
private Long creditCardId;

@Column(name="EXP_DATE")
private Date expirationDate;

@Column(name="NUMBER")
private String number;

@Column(name="NAME")
private String name;

@OneToOne(mappedBy="creditCard",optional=false,orphanRemoval=true)
private Customer customer;

public Date getExpirationDate() {
return expirationDate;
}

public void setExpirationDate(Date expirationDate) {
this.expirationDate = expirationDate;
}

public String getNumber() {
return number;
}

public void setNumber(String number) {
this.number = number;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public Long getCreditCardId() {
return creditCardId;
}

public Customer getCustomer() {
return customer;
}

public void setCustomer(Customer customer) {
this.customer = customer;
}

------ DB Tables --------
CREATE TABLE `customer` (
`CUSTOMER_ID` bigint(20) NOT NULL AUTO_INCREMENT,
`FIRST_NAME` varchar(45) NOT NULL,
`LAST_NAME` varchar(45) NOT NULL,
`ADDRESS_ID` int(11) NOT NULL,
`CREDIT_CARD_ID` bigint(20) NOT NULL,
PRIMARY KEY (`CUSTOMER_ID`),
KEY `FK_CUST_ADDRESS` (`ADDRESS_ID`),
KEY `FK_CUST_CC` (`CREDIT_CARD_ID`),
CONSTRAINT `FK_CUST_CC` FOREIGN KEY (`CREDIT_CARD_ID`) REFERENCES `credit_card` (`CREDIT_CARD_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `FK_CUST_ADDRESS` FOREIGN KEY (`ADDRESS_ID`) REFERENCES `address` (`ADDRESS_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=ascii$$


CREATE TABLE `credit_card` (
`CREDIT_CARD_ID` bigint(20) NOT NULL AUTO_INCREMENT,
`EXP_DATE` date NOT NULL,
`NUMBER` varchar(20) NOT NULL,
`NAME` varchar(45) NOT NULL,
`CUSTOMER_ID` bigint(20) DEFAULT NULL,
PRIMARY KEY (`CREDIT_CARD_ID`),
KEY `FK_CC_CUSTOMER` (`CUSTOMER_ID`),
CONSTRAINT `FK_CC_CUSTOMER` FOREIGN KEY (`CUSTOMER_ID`) REFERENCES `customer` (`CUSTOMER_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=ascii$$