[JBossWS] - Problem using a SOAP interface on JBOSS server
by Milochanzy
Hi,
I am accesing a HTTP/SOAP interface thru a application deployed on JBOSS server. All workis fine till I invoke the method for making the transaction then I am getting following error:
| javax.xml.ws.WebServiceException: org.jboss.ws.WSException: Target endpoint address not set
| at org.jboss.ws.core.jaxws.client.ClientImpl.handleRemoteException(ClientImpl.java:317)
| at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:255)
| at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:164)
| at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150)
| at $Proxy174.submit(Unknown Source)
|
I could only see one WARNING up the trace:
| 2008-05-11 16:13:35,514 WARN [org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl] Cannot access wsdlURL: file:/C:/Documents%20and%20Settings/cm304k/My%20Documents/R7/WFM%20IIA/GRANITEAsgnMgmt_QNI_AD_MERGE/GRANITEAsgnMgmt.wsdl
| 2008-05-11 16:13:35,524 WARN [org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl] Cannot get port meta data for: {http://granite.it.att.com/asgnmgmt/v1}AsgnMgmtSoapHttpPort
|
I have compiled the WSDL file and put the classes in the application jar.
Please Suggest.
Thanks and Regards,
Milan.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4150013#4150013
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4150013
16 years, 7 months
[JBossWS] - Basic Web Service with client
by Hattori Hanzo
Hi Guys look i have this problem, im trying to run in my JBOSS 4.0.2 Application Server one Simple Web Service Project, i already build my service.xml archive like this...
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet-name>XFireServlet</servlet-name>
<servlet-class>org.codehaus.xfire.transport.http.XFireConfigurableServlet</servlet-class>
<load-on-startup>0</load-on-startup>
<servlet-mapping>
<servlet-name>XFireServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
And i create my clase and the interface of this class this way...
The interface Class
//Generated by MyEclipse
public interface ITest_WService {
public String example(String message);
}
The Class
//Generated by MyEclipse
public class Test_WServiceImpl implements ITest_WService {
public String example(String message) {
return message;
}
}
And i already build a new WSDL archive...
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.example.org/testws/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="testws" targetNamespace="http://www.example.org/testws/">
<wsdl:types>
<xsd:schema targetNamespace="http://www.example.org/testws/">
<xsd:element name="NewOperation">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="in" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="NewOperationResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="out" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="DatoEntrada" type="xsd:string"></xsd:element>
<xsd:element name="DatoSalida" type="xsd:string"></xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="NewOperationRequest">
<wsdl:part element="tns:DatoEntrada" name="parameters"/>
</wsdl:message>
<wsdl:message name="NewOperationResponse">
<wsdl:part element="tns:DatoSalida" name="parameters"/>
</wsdl:message>
<wsdl:portType name="testws">
<wsdl:operation name="NewOperation">
<wsdl:input message="tns:NewOperationRequest"/>
<wsdl:output message="tns:NewOperationResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="testwsSOAP" type="tns:testws">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="NewOperation">
<soap:operation soapAction="http://www.example.org/testws/NewOperation"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="testws">
<wsdl:port binding="tns:testwsSOAP" name="testwsSOAP">
<soap:address location="http://www.example.org/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
so.. now when i open my Web Service Explorer to test my wsdl archive, i send the string and the request of that petition is this...
The SOAP response failed schema validation. Please switch to the source view for the SOAP response in XML format.
Can some one help me pls? im using JDK 1.5.0_15 version and my Application Server is JBOSS 4.0.2
maybe i think is some problem with the versions, but maybe was the code or the XFire :( i dont know can somebody help me pls?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4149873#4149873
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4149873
16 years, 7 months
[JBossWS] - Re: Web Service Client
by bsisson
In my Eclipse client I generated the web service stubs and proxy by creating a new project, then right clicking on the project selecting new->other->web service->web service client. When setting up the client I pointed it to my web service WSDL file ex:(http://localhost:8280/PSDynamicWebProject/TestWs?wsdl). I then just setup a simple test class to call the web service (code below):
package service.client;
import java.rmi.RemoteException;
import org.domain.PSDynamicWebProject.pojo.TestWs;
import org.domain.PSDynamicWebProject.pojo.TestWsProxy;
public class RunnerOld
{
public static void main(String[] args)
{
TestWs tw = new TestWsProxy();
try
{
System.out.println(tw.greet("1"));
}
catch (RemoteException e)
{
System.out.println(e.getMessage());
}
}
}
This code worked fine (called the web service and received the correct response back).
Now I wanted to create the web service client using the annotations from JSR-181. I looked a several different examples and the best that I can conclude is that I still need to generate the stubs and proxy files so I set them up in my project in the same way as I did above. I then create a simple class to call my web service (code below):
package service.client;
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
import javax.xml.ws.WebServiceRef;
import org.domain.PSDynamicWebProject.pojo.TestWs;
import org.domain.PSDynamicWebProject.pojo.TestWsService;
public class Runner
{
@WebServiceRef(wsdlLocation="http://127.0.0.1:8280/PSDynamicWebProject/TestWs?wsdl")
private static TestWsService service;
public static void main(String[] args)
{
try
{
TestWs tw = service.getTestWsPort();
System.out.println(tw.greet("1"));
}
catch (RemoteException e)
{
System.out.println(e.getMessage());
}
catch (ServiceException e)
{
System.out.println(e.getMessage());
}
}
}
This client however failed. It got a java null pointer exception on this statement: TestWs tw = service.getTestWsPort(); I debugged it and found tha the service object was null.
I have several questions regarding this approach:
1) I am curious why the service object was null and I got a null pointer exception?
2) Is this the correct way to setup and use the JSR-181? I find it interesting that if we still must generate the stubs and prox from the WSDL before we can use the annotations then what advantage is there to using the annotations?
Any clarity and help would be greatly appreciated. I can see the benefit in using JSR-181 to setup the web services from previous web services that I setup and the advantage of the annotations. However, I don't see any benefits in the annotations on the client if I'm doing this correctly (which I may not be).
Here is the simple code from my web serivce for review (this works):
package org.domain.PSDynamicWebClient.pojo;
import java.io.StringWriter;
import java.util.Date;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import javax.xml.transform.stream.StreamResult;
import org.domain.PSDynamicWebClient.entity.Employee;
import org.domain.PSDynamicWebClient.session.SelectEmployee;
import org.jboss.seam.Component;
/**
* This is a webservice class exposing a method called greet which takes a
* input parameter and greets the parameter with hello.
*
* @author dhanago
*/
/*
* @WebService indicates that this is webservice interface and the name
* indicates the webservice name.
*/
@WebService(name = "TestWs", serviceName = "TestWsService")
/*
* @SOAPBinding indicates binding information of soap messages. Here we have
* document-literal style of webservice and the parameter style is wrapped.
*/
@SOAPBinding
(
style = SOAPBinding.Style.DOCUMENT,
use = SOAPBinding.Use.LITERAL,
parameterStyle = SOAPBinding.ParameterStyle.WRAPPED
)
public class TestWs
{
@WebMethod
public String greet( @WebParam(name = "emplid")
String emplid )
{
try
{
/**************************************************************************
* The following example marshals an object class into an XML string which
* is returned to the caller. The object is an entity representing a
* row on the database.
**************************************************************************/
// Query the database for an employee's information
SelectEmployee selectEmployee = (SelectEmployee) Component.getInstance("selectEmployee");
selectEmployee.setId(emplid);
Employee e = selectEmployee.getInstance();
// Marshal the employee information into an xml string and return it
JAXBContext context = JAXBContext.newInstance(Employee.class);
Marshaller marshaller = context.createMarshaller();
StreamResult result = new StreamResult( new StringWriter());
marshaller.marshal(e, result);
return result.getWriter().toString();
}
catch (Exception e)
{
return e.getMessage();
}
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4149858#4149858
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4149858
16 years, 7 months
[JBossWS] - Web Service Client
by bsisson
I have found several very good tutorials for creating a web service using annotations (JSR-181). I am struggling however creating a web service client using annotations. I'm working with Eclipse 3.3 and Seam 2.0. I did the old web service client way of creating a project, then generating a web service client from the wsdl which generates the stubs and this works fine. However, I want to be able to do this with annotations instead and am struggling. I have seen examples that use the @WebServiceRefs annotations but no complete explenation. I would expect if I use annotations that I will not have to generate the stubs from the WSDL but have no clarity. If you can point me to a good tutorial that would be great? If you could clarify whether I need to generate the stubs from the WSDL that would be helpful as well?
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4149807#4149807
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4149807
16 years, 7 months
[JBossWS] - Error: ...Port does not contain operation meta data for: ...
by hermida
Hi everyone,
I have written a test web service with JBoss 4.2.2.GA and I have what seems to be an oversight error (on my part I am sure) that I cannot figure out :) I searched this forum and others have had the same problem but then there is no clear answer in the responses as to what is the real source of the problem and how to fix it. My code compiles and deploys into the application server properly but when I use a web service client to test a method call I get the following strange error about operation meta data not being there:
anonymous wrote : 2008-05-08 16:48:46,996 ERROR [org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS] SOAP request exception
| org.jboss.ws.core.CommonSOAPFaultException: Endpoint {http://wstest.fmi.ch/}UserServiceBeanPort does not contain operation meta data for: {http://wstest.fmi.ch/}GetUserByUsername
| at org.jboss.ws.core.server.ServiceEndpointInvoker.getDispatchDestination(ServiceEndpointInvoker.java:457)
| at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:176)
| at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:408)
| at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:272)
| at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:189)
Here is the POSTed SOAP body:
<soap:Body xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>
| <tns:GetUserByUsername xmlns:tns='http://wstest.fmi.ch/'>
| <Username xsi:type='xsd:string' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>hermida</Username>
| </tns:GetUserByUsername>
| </soap:Body>
Here are the important web service code (and where a possible error could be):
UserServiceWSInterface.java
//package ch.fmi.wstest;
|
| /**
| * Web service interface for the UserServiceBean session bean.
| *
| */
| @javax.jws.WebService(targetNamespace = "http://ch.fmi/wstest", name = "UserService")
| @javax.jws.soap.SOAPBinding(style = javax.jws.soap.SOAPBinding.Style.RPC, use = javax.jws.soap.SOAPBinding.Use.LITERAL, parameterStyle = javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED)
| public interface UserServiceWSInterface
| extends java.rmi.Remote
| {
| @javax.jws.WebMethod(operationName = "GetUserByUsername")
| public ch.fmi.wstest.User getUserByUsername(
| @javax.jws.WebParam(name = "Username") java.lang.String username
| ) throws java.rmi.RemoteException;
|
| }
UserServiceBean.java
// license-header java merge-point
| //
| // Generated by: SessionBeanImpl.vsl in andromda-ejb3-cartridge.
| //
| package ch.fmi.wstest;
|
| /**
| * @see ch.fmi.wstest.UserServiceBase
| *
| * Remember to manually configure the local business interface this bean implements if originally you only
| * defined the remote business interface. However, this change is automatically reflected in the ejb-jar.xml.
| *
| * Do not specify the javax.ejb.Stateless annotation
| * Instead, the session bean is defined in the ejb-jar.xml descriptor.
| */
| @javax.jws.WebService(endpointInterface = "ch.fmi.wstest.UserServiceWSInterface")
| @org.jboss.wsf.spi.annotation.WebContext(contextRoot = "/wstest-ws", urlPattern="/services/UserService/*")
| public class UserServiceBean
| extends ch.fmi.wstest.UserServiceBase
| implements ch.fmi.wstest.UserServiceRemote
| {
|
| // --------------- Constructors ---------------
|
| /**
| * Default constructor extending base class default constructor
| */
| public UserServiceBean()
| {
| super();
| }
|
| // -------- Business Methods Impl --------------
|
| /**
| * @see ch.fmi.wstest.UserServiceBase#getUserByUsername(java.lang.String)
| */
| protected ch.fmi.wstest.User handleGetUserByUsername(java.lang.String username)
| throws java.lang.Exception
| {
| //TODO: put your implementation here.
| // Dummy return value, just that the file compiles
| return null;
| }
|
|
| // -------- Lifecycle Callback Implementation --------------
|
| }
|
Here are the WSDLs:
http://localhost:8080/wstest-ws/services/UserService?wsdl
<definitions name="UserServiceBeanService" targetNamespace="http://wstest.fmi.ch/">
| <import location="http://localhost.fmi.ch:8080/wstest-ws/services/UserService?wsdl&resource..." namespace="http://ch.fmi/wstest"/>
| <service name="UserServiceBeanService">
| <port binding="ns1:UserServiceBinding" name="UserServiceBeanPort">
| <soap:address location="http://localhost.fmi.ch:8080/wstest-ws/services/UserService"/>
| </port>
| </service>
| </definitions>
http://localhost.fmi.ch:8080/wstest-ws/services/UserService?wsdl&resource...
<definitions name="UserServiceBeanService" targetNamespace="http://ch.fmi/wstest">
| <types>
| <xs:schema targetNamespace="http://ch.fmi/wstest" version="1.0">
| <xs:complexType name="user">
| <xs:sequence>
| <xs:element minOccurs="0" name="id" type="xs:long"/>
| <xs:element minOccurs="0" name="password" type="xs:string"/>
| <xs:element minOccurs="0" name="username" type="xs:string"/>
| </xs:sequence>
| </xs:complexType>
| </xs:schema>
| </types>
| <message name="UserService_GetUserByUsernameResponse">
| <part name="return" type="ns1:user"/>
| </message>
| <message name="UserService_GetUserByUsername">
| <part name="Username" type="xsd:string"/>
| </message>
| <portType name="UserService">
| <operation name="GetUserByUsername" parameterOrder="Username">
| <input message="ns1:UserService_GetUserByUsername"/>
| <output message="ns1:UserService_GetUserByUsernameResponse"/>
| </operation>
| </portType>
| <binding name="UserServiceBinding" type="ns1:UserService">
| <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
| <operation name="GetUserByUsername">
| <soap:operation soapAction=""/>
| <input>
| <soap:body namespace="http://wstest.fmi.ch/" use="literal"/>
| </input>
| <output>
| <soap:body namespace="http://wstest.fmi.ch/" use="literal"/>
| </output>
| </operation>
| </binding>
| </definitions>
Why is it not finding the operation meta data? Is it a namespace problem?
thanks for any help,
leandro
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4149742#4149742
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4149742
16 years, 7 months