aspose file tools*
The moose likes Web Services and the fly likes ServiceFactory.newInstance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "ServiceFactory.newInstance" Watch "ServiceFactory.newInstance" New topic
Author

ServiceFactory.newInstance

Karthik Rajendiran
Ranch Hand

Joined: Aug 13, 2004
Posts: 211
Hello Friends,
In our project, we are using resin 3.0.23.

We were trying to writing a webservice client in a sample webapplication.

1. In web.xml , we are unable to specify the service-ref tag and we get error while starting resin
element start: service-ref

[09:58:17.119]element start: service-ref-name
[09:58:17.127]org.xml.sax.SAXParseException: <service-ref-name> is an unexpected tag (parent <service-ref> starts at 92).
[09:58:17.127]
[09:58:17.127]</service-ref> is expected to close.
09:58:17.127]
[09:58:17.127]<service-ref> syntax: empty

2. Contents of web.xml Entry.
<service-ref xmlns:impl="http://testws.example.com/" >
<service-ref-name>service/EmployeeWebServiceMam</service-ref-name>
<service-interface>com.example.testws.EmployeeWebService</service-interface>
<wsdl-file>WEB-INF/wsdl/EmployeeService.wsdl</wsdl-file>
<service-qname>impl:EmployeeService</service-qname>
</service-ref>


So We thought of going through another mechanism of accessing Client
try {
System.out.println("Begin");
QName serviceName = new QName("http://www.elephant.com/RP", "RealTimeService");
String endPointUrl = "http://10.28.234.127:7201/SOAP";
URL wsdlURL = new URL("http://10.28.234.127:7201/SOAP?WSDL");
ServiceFactory factory = ServiceFactory.newInstance();
javax.xml.rpc.Service service = factory.createService(wsdlURL, serviceName);
System.out.println("Here service created");

}
catch(Exception e) {
System.out.println("exception");
}
finally {
System.out.println("Finally");
}


Here, i dont get the code executed after servicefactory.newInstance, I get control directly finally.
Same code works fine in tomcat. I checked resin logs in debug mode, nothing exception shown.

Is there any conflict between resin jars and axis jars of jaxrpc?


SCJP 1.4 SCWCD 1.4 SCDJWS 1.4
krishnamoorthy kitcha
Ranch Hand

Joined: Feb 04, 2006
Posts: 96
Hi karthik,


This is parser Exception the xml tag is not close properly .

2. Contents of web.xml Entry.
<service-ref xmlns:impl="http://testws.example.com/" >
<service-ref-name>service/EmployeeWebServiceMam</service-ref-name>
<service-interface>com.example.testws.EmployeeWebService</service-interface>
<wsdl-file>WEB-INF/wsdl/EmployeeService.wsdl</wsdl-file>
<service-qname>impl:EmployeeService</service-qname>
</service-ref>

In that you should close properly like

<service-ref xmlns:impl="http://testws.example.com"/ >

or
<service-ref> xmlns:impl=http://testws.example.com</service-ref>

Please test the same and tell your feedback.

Regards
k.krishnamoorthy.
Karthik Rajendiran
Ranch Hand

Joined: Aug 13, 2004
Posts: 211
Hello Krishna sir,
Thanks for replying, But as you said,

A service-ref Element in web.xml: as Per
site

http://docs.google.com/View?docid=d77kkqc_6t2nhch

<service-ref xmlns:mh="http://www.mdc.com/mdc/BookQuote">
<service-ref-name>service/BookQuoteService</service-ref-name>
<service-interface>com.mdc.jaxrpc.BookQuoteService</service-interface>
<wsdl-file>BookQuote.wsdl</wsdl-file>
<service-qname>mh:BookQuoteService</service-qname>
</service-ref>

I am trying as per the book and example

<service-ref> is parent tag which got other tags as child
Pedro Erencia
Ranch Hand

Joined: Apr 03, 2008
Posts: 70
Hi Karthik Rajendiran,
check this
It seems to be some problem with the sax parsing in resin..

Here, i dont get the code executed after servicefactory.newInstance, I get control directly finally.

You have to get "Here service created" or "exception".. it's not possible to go from "Begin" to "Finally" in your code...
[ May 22, 2008: Message edited by: Pedro Erencia ]
Karthik Rajendiran
Ranch Hand

Joined: Aug 13, 2004
Posts: 211
Thanks you very much for the reply.

1. Do you mean we need to use 3.0.24, but in our production server we use 3.0.23 , upgrading needs to go regression testing in our applications. practically not feasible

2. Alternatively, instead of service-ref tag, we tried


One question for the service-ref, is that configuration alone is enough or should i have to do any other jndi related configurations?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ServiceFactory.newInstance