netbeans etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
netbeans etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

4 Nisan 2011 Pazartesi

problem passing time info through jaxws web service

reading http://hilaltarakci.blogspot.com/2009/10/revisited-troobleshooting-date-becomes.html beforehand may be useful for this post..


there was a problem while passing date info through jaxws web service; time info was absent..
However, editing the DateAdapter as follows solved the problem:

public class DateAdapter {

public static Date parseDate(String s) {
System.out.println("========= DateAdapter.parseDate param:" + s);
System.out.println("========= DateAdapter.parseDate:" + DatatypeConverter.parseDate(s).getTime().toString());
return DatatypeConverter.parseDate(s).getTime();
}

public static String printDate(Date dt) {
Calendar cal = new GregorianCalendar();
cal.setTime(dt);
//System.out.println("========= DateAdapter.printDate param:" + dt.toString());
System.out.println("========= DateAdapter.printDate: " + DatatypeConverter.printDateTime(cal).toString());
return DatatypeConverter.printDateTime(cal).toString();
}
}

10 Ocak 2011 Pazartesi

changing netbeans locale

i am trying to reengineer my master thesis work in order to prsesent it as a set of web services instead of a web application.. well, it is not as easy as it seems, since i am also migrating the development environment from eclipse + tomcat + mysql to netbeans 6.8 + glassfish v3 + derby coming with netbeans ide.. while glassfish v3 is started, it comes up with this error:
Server cannot operate in current Locale. Locale is switched to en_US for the process.

actually, after clicking on the dialog box with the error, the server starts and the web service is deployed successfully, i can see the wsdl.. however, when i try to generate client stubs for a java client, stubs seems problematic.. Its the - big i - issue, if you see: (it says illegal character \65533)
private final static URL ONTOLOGYMNGWSSERV�CE_WSDL_LOCATION;
private final static WebServiceException ONTOLOGYMNGWSSERV�CE_EXCEPTION;
private final static QName ONTOLOGYMNGWSSERV�CE_QNAME = new QName("http://ws.moass.com/", "OntologyMngWSService");
therefore, i want to change my Netbeans Locale to en_US in order to generate client stubs currectly..

unfortunately, changing the Locale by adding -locale en_US to netbeans_default_options= in NETBEANS_HOME/etc/netbeans.conf file did not help my cause..

i still get the error :(

Edit on 11/1/2011, 13:23:
i tried the same thing on my office computer which is an OpenSuse environment.. i checked the locale with env command, it is set to en_US.. luckily, the above error did not show up this time.. however, it tries to generate constructors such as
public CalculatorWSService(WebServiceFeature... features) {
super(__getWsdlLocation(), CALCULATORWSSERVICE_QNAME, features);
}
and the super method results in error this time..
by the way, i made the test with Netbeans 6.9.1 and glassfish v3.1..

on the contrary, my home computer is windows vista and here is how to change windows locale: http://windows.microsoft.com/en-US/windows7/Change-the-system-locale

27 Ekim 2009 Salı

revisited : Troobleshooting: Date becomes XMLGregorianCalendar when stubs are generated at client side, how to prevent this?

lets revisit issue on http://hilaltarakci.blogspot.com/2009/06/troobleshooting-date-becomes.html
the problem is, although adapter interface is generated, the generated implementation for the interface is empty.. so, sould replace with own implementation..

btw, soln is discovered by someone in the team, not me.. lets share it :  https://jaxb.dev.java.net/guide/Using_different_datatypes.html


5 Temmuz 2009 Pazar

jbpm bpel - first steps

i am looking for someway to deploy my bpel processes on jboss app server. i do not want to use jpdl which is not a standart, so i stuck to bpel.

This seems to be a solution: http://www.jboss.org/jbossjbpm/bpel/
As such, it can execute processes authored with the Eclipse BPEL designer or any other editor that produces standard BPEL documents.

Bpel designers generally generate some extra xml and so, it may be possible that you can not open your bpel process designed with Activos Designer with Eclipse Bpel Designer,or vice versa. (correct if i am wrong:)) However, OpenESB allows me to produce clean, standart bpel file without adding any extra xml. (When you design a process with Open Esb (Netbeans) Bpel designer, you will notice that the location for the elements are fixed in the GUI, you can not put anything you like at anywhere in the designer, you have to choose from some predefined locations.. i think that is why Netbeans designer's bpel is so clean:) since it does not require to keep the location info, no extensions to standard bpel is needed..) Therefore, the above sentence about jbpm bpel (in italic) is important to me.. This means, i may develop my bpel process with OpenEsb designer and deploy to jbpm bpel.. This post is to note down that experience..

The steps are as follows:

  • in order to make use of the examples coming with the jbpm bpel package, the following must be already installed:
- ant
- jboss app server (4.x.x is required according to https://jira.jboss.org/jira/secure/attachment/12311453/jbpm.bpel.guide.pdf)
- java 1.5 (i do not know why, but i could not make jwsdp accept jdk 6, during installation, that is why i need jdk 1.5, more specifically jdk1.5.0_19 is ok)
- java web services developer pack (the examples use wscompile etc. ant tasks from here, so using metro instead is expensive, i gave up on the way half.. ) jwsdp is needed just for running the given examples, not part of the actual solution. in actual case, metro web service stack will be used instead..

this package includes many bpel samples. however, in order to run these samples properly, the following modifications may be needed:

  • In jbpm-bpel-1.1.1/examples/common/build.properties file, modify the following properties accordingly:

jboss.version=4.2.3.GA (i am using this already, but any 4.x.x is said to be ok)
jboss.home=${software.installation.dir}/jboss-${jboss.version} (if different)
jwsdp.home=${software.installation.dir}/jwsdp-1.6
javac.source=1.4 (modify as 1.5)
javac.target=1.4 (modify as 1.5)

  • start jboss, (starting from port 8080 may be required, not sure. if something goes wrong, check that..)
  • execute command ant inside jbpm-bpel-1.1.1/examples, it should execute with success..
  • lets see if wsdl s are available:
http://127.0.0.1:8080/account/accountSystem?wsdl
http://127.0.0.1:8080/invoice/invoiceService?wsdl
http://127.0.0.1:8080/scheduling/schedulingProcess?wsdl
http://127.0.0.1:8080/shipping/shippingService?wsdl
http://127.0.0.1:8080/task/taskManager?wsdl
http://127.0.0.1:8080/ticket/ticketIssuer?wsdl
http://127.0.0.1:8080/translator/document?wsdl
http://127.0.0.1:8080/translator/text?wsdl

i got the addresses for the wsdl s from ${JBOSS_HOME}/server/default/data/wsdl

now it is time to dive into https://jira.jboss.org/jira/secure/attachment/12311453/jbpm.bpel.guide.pdf deeper, but it can wait :)
i do not want to ruin my sunday afternoon with that :)

Edit on 6/7/2009, 12.04: Sorry, i have forgotten to deploy jbpm-bpel itself on jboss.. So, at anytime you like, execute command ant deploy.ear inside /jbpm-bpel/jbpm-bpel-1.1.1/deploy and jbpm-bpel will be deployed on jboss. try to see jbpm bpel console from http://localhost:8080/jbpm-bpel/

Edit on 7/7/2009, 10.55: Yeah, OpenESB designer produces standard bpel files. However, unfortunately this does not mean that it could open every standard bpel file in its designer.. 

19 Haziran 2009 Cuma

Troobleshooting: Date becomes XMLGregorianCalendar when stubs are generated at client side, how to prevent this?

The Problem Part:

The environment: Netbeans 6.5 Ide and Glassfish as, on x64 linux machine (open suse).

Here is the sample web service with java.util.Date type:

package com.example.date;

import java.util.Date;

import javax.jws.WebMethod;

import javax.jws.WebParam;

import javax.jws.WebService;

@WebService()

public class DateWebService {

@WebMethod(operationName = "dateOperation")

public Date dateOperation(@WebParam(name = "date")

Date date) {

return date;

}

}

The wsdl is at http://localhost:8080/DateProject/DateWebServiceService?WSDL

The dependent xsd is at http://localhost:8080/DateProject/DateWebServiceService?xsd=1

The input and output types for dateOperation is as follows:

<xs:complexType name="dateOperation">

<xs:sequence>

<xs:element name="date" type="xs:dateTime" minOccurs="0"/>

(<xs:sequence>

</xs:complexType>

<xs:complexType name="dateOperationResponse">

<xs:sequence>

<xs:element name="return" type="xs:dateTime" minOccurs="0"/>

</xs:sequence>

<xs:complexType>

It is obvious that java.util.Date is mapped to xs:dateTime.

Lets see what happens when we generate the client stubs from the wsdl. (This is done by right clicking the project in Netbeans and selecting New Web Service Client and entering the wsdl to the related input.)

The generated stubs are at the following location:



Java.util.Date becomes javax.xml.datatype.XMLGregorianCalendar when xml is mapped to Java types againL (Comments are omitted from the following generated code for simplicity..)

package com.example.date;

import javax.xml.bind.annotation.XmlAccessType;

import javax.xml.bind.annotation.XmlAccessorType;

import javax.xml.bind.annotation.XmlSchemaType;

import javax.xml.bind.annotation.XmlType;

import javax.xml.datatype.XMLGregorianCalendar;

@XmlAccessorType(XmlAccessType.FIELD)

@XmlType(name = "dateOperation", propOrder = {

"date"

})

public class DateOperation {

@XmlSchemaType(name = "dateTime")

protected XMLGregorianCalendar date;

public XMLGregorianCalendar getDate() {

return date;

}


public void setDate(XMLGregorianCalendar value) {

this.date = value;

}

}

The reason for this is explained here: http://forums.java.net/jive/message.jspa?messageID=166006

So, the question is what sould be done to get java.util.Date instead of XMLGregorianCalendar when the stubs are generated at the client side?


The Solution Part:

Data conversion at the client side is a solution: http://www.velocityreviews.com/forums/t462336-convert-jaxb-xmlgregoriancalendar-to-javasqldate.html

However, this may not be the case if you definitely want to get Date back when stubs are generated..

Prepare the following file i named jax-ws-jaxb-customization.xml:


<?xml version="1.0" encoding="UTF-8"?>

<jaxws:bindings  node="wsdl:definitions/wsdl:types/xsd:schema"

                                xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"

                                xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"

                                xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"

                                xmlns:xsd="http://www.w3.org/2001/XMLSchema" wsdlLocation="../wsdl/localhost_8080/DateProject/DateWebServiceService.wsdl">

<jaxb:globalBindings>

                               <jaxb:serializable/>

                               <jaxb:javaType name="java.util.Date"

                                                      xmlType="xsd:dateTime"/>

                </jaxb:globalBindings>

</jaxws:bindings>

Use Netbeans Wsdl Customizer :

Right click the web service under Web Service References, seleck Edit Web Service Attributes and select the second tab named WSDLCustomization

Select the below External Binding File part and add jax-ws-jaxb-customization.xml as follows:

Now, examine the generated stubs again, DateOperation is now as follows (again comments are removed for simplicity):

package com.example.date;

import java.io.Serializable;

import java.util.Date;

import javax.xml.bind.annotation.XmlAccessType;

import javax.xml.bind.annotation.XmlAccessorType;

import javax.xml.bind.annotation.XmlElement;

import javax.xml.bind.annotation.XmlSchemaType;

import javax.xml.bind.annotation.XmlType;

import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

import org.w3._2001.xmlschema.Adapter1;

@XmlAccessorType(XmlAccessType.FIELD)

@XmlType(name = "dateOperation", propOrder = {

"date"

})

public class DateOperation

implements Serializable

{

@XmlElement(type = String.class)

@XmlJavaTypeAdapter(Adapter1 .class)

@XmlSchemaType(name = "dateTime")

protected Date date;

public Date getDate() {

return date;

}

public void setDate(Date value) {

this.date = value;

}

}

And now there is a difference in the generated stubs, an Adapter1 is also generated:

package com.example.date;

import java.io.Serializable;

import java.util.Date;

import javax.xml.bind.annotation.XmlAccessType;

import javax.xml.bind.annotation.XmlAccessorType;

import javax.xml.bind.annotation.XmlElement;

import javax.xml.bind.annotation.XmlSchemaType;

import javax.xml.bind.annotation.XmlType;

import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

import org.w3._2001.xmlschema.Adapter1;

@XmlAccessorType(XmlAccessType.FIELD)

@XmlType(name = "dateOperation", propOrder = {

"date"

})

public class DateOperation

implements Serializable

{

@XmlElement(type = String.class)

@XmlJavaTypeAdapter(Adapter1 .class)

@XmlSchemaType(name = "dateTime")

protected Date date;

public Date getDate() {

return date;

}

public void setDate(Date value) {

this.date = value;

}

}

So, problem solved for now :)

Edit on 22.06.2009  14.15 : The display problem in xml part of the post is fixed by now :)

11 Mayıs 2009 Pazartesi

OpenESB

Hello all, this writing is about my first steps through Open ESB..
Very first step is installing GlassFish ESB v2 GA (Nov 2008, Stable & Released) which also includes netbeans 6.1 ide & glassfish v2. (https://open-esb.dev.java.net/Downloads.html)
Tutorial on http://www.netbeans.org/kb/61/soa/synchsample.html is very straightforward..

Now it is time to create a composite application from scratch.. The steps are:
  • create a sample web service to invoke from the following process. I used a random number generator..
  • create New Project/SOA/Bpel Module
  • create New Project/SOA/Composite Application
  • right click composite app and add created bpel module as new jbi module for that app.
  • create a Bpel process in Bpel module.
  • create a Wsdl (abstract) in Bpel module.
  • add PartnerLink to your bpel file with the type in the wsdl., the wsdl is automatically imported by the Bpel process.
  • add receive and reply elements to be pointed by that partnerlink.
  • copy the wsdl of the outer ws to bpel module. do not forget to copy all dependent files such as xsd s and update the location definitions in wsdl.
  • add wsdl import by file.
  • create a partnerlink for that wsdl in bpel file. this creates a wrapper wsdl for the outer wsdl and automatically adds them to the main wsdl of the process.
  • do not forget to replace the soap location as 9080 in the main wsdl of the process.
  • create a binding and a service for the main wsdl. otherwise, you can not test them via test node of the composite app.
  • deploy the composite app.
  • test the process via the test node in the composite app.
My next step will probably be this: http://blogs.sun.com/toxophily/entry/visual_web_pack_tip_using

Btw, i really liked OpenESB.. It provides a compact environment for web service development and orchestration.. Deployment and testing the process is very very easy. (Testing the deployed process in Eclipse Bpel + Apache ODE killed me before, but maybe it is my unskillfulness, so i say this out of the record :)) ) I liked the robustness and user friendliness of the Netbeans Bpel designer. Deleting elements from the process or moving the elements does not lead to problems..
That is all for now :)

Edit on 25.06.2009 11:12 : I supposed that full netbeans ide download does not provide me with open esb, but i was wrong (due to wrong download:( ) So, netbeans (with all option) from http://www.netbeans.org/downloads/start.html?platform=linux&lang=en&option=all&version=6.5.1 also supports open esb..

Edit on 26.06.2009 11.16: This is also a step-by-step tutorial http://www.netbeans.org/kb/61/soa/helloworldca.html