[JBossWS] - Getting Soap Header from WebServiceContext's MessageContext
by dhanushgopinath
Hi,
I want to access some SOAP Header values inside the WebService when it is called.
(I know I can use server side handlers fro this, but I do not want to use it as I want the header values for some application inside the web service)
So I use the injection using WebServiceContext, and then get the SOAPMessageCotnext by
SOAPMessageContext soapMsgContext = (SOAPMessageContext) context.getMessageContext();
And then I get the SoapMessage and Soap Header
| SOAPEnvelope envelope = soapMessageContext.getMessage().getSOAPPart()
| .getEnvelope();
|
| SOAPHeader soapHeader = envelope.getHeader();
| // Extract All header elements.
| Iterator headerElements = soapHeader.extractAllHeaderElements();
The Iterator headerElements, doesnt have any values in it.
Why is this happening? Doesn't the WebServiceContext return the SoapHeaders.
I checked the rest of the SOAP Message and Soap Body is having only the body elements, it doesn't have any values.
Please let me know in case anyone of u faced the same problems
Thanks
Dhanush
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4223896#4223896
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4223896
15 years, 8 months
[JBossWS] - error with wssecurity!!!!
by joncmuniz
My webservice is working without the configuration wssecurity,
when I put the settings an error occurs
- put a annotation in webservices
-----@EndpointConfig(configName="Standard WSSecurity Endpoint")
- put the files in the web-inf
------jboss-wsse-server.xml and the jboss-wsse-client.xml in the client side together with the other files
------wsse.cer
------wsse.csr
------wsse.jks
my client is in the servlet
QName qName = new QName("http://coreo.com.br/teste", "Teste");
String serviceURL = "http://jon.ctbc.com.br:8080/jbossWebServiceSecurity-1.0.0/Teste?wsdl";
Service service = null;
URL url;
try {
url = new URL(serviceURL);
service = Service.create(url,qName);
ITeste s = service.getPort(ITeste.class);
System.out.println(s.localizacao("jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj"));
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
09:09:30,343 ERROR [[MyServlet]] Servlet.service() for servlet MyServlet threw exception
javax.xml.ws.soap.SOAPFaultException: This service requires <wsse:Security>, which is missing.
at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.getSOAPFaultException(SOAPFaultHelperJAXWS.java:84)
at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.throwFaultException(SOAP11BindingJAXWS.java:107)
at org.jboss.ws.core.CommonSOAPBinding.unbindResponseMessage(CommonSOAPBinding.java:579)
at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:381)
at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:290)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:170)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150)
at $Proxy82.localizacao(Unknown Source)
at br.teste.client.MyServlet.executa(MyServlet.java:54)
at br.teste.client.MyServlet.doGet(MyServlet.java:33)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Thread.java:595)
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4223648#4223648
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4223648
15 years, 8 months
[JBossWS] - faultString: Endpoint ... Port does not contain operation me
by gopivm
Hi,
I am facing a problem while invoking the web service method which is exposed from stateless session bean (EJB3) by DII client.
This is my development environment.
Eclipse Version: 3.4.0
Jboss-4.3.2.GA
JRE 1.5.0_15
EJB 3.0
I "googled" a lot, but couldn't find any correct solution which actually works. But, there are a lot of people have faced the same problem.
Can somebody help me?
This is the error that I am getting :
| AxisFault
| faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
| faultSubcode:
| faultString: Endpoint {http://woss.appservice.nbric.nbpts.com/}WarehouseServiceBeanPort does not co
| ntain operation meta data for: {http://schemas.xmlsoap.org/wsdl/}searchPersonsForWarehouseBatch
| faultActor:
| faultNode:
| faultDetail:
| {http://xml.apache.org/axis/}stackTrace:Endpoint {http://woss.appservice.nbric.nbpts.com/}Warehouse
| ServiceBeanPort does not contain operation meta data for: {http://schemas.xmlsoap.org/wsdl/}searchPe
| rsonsForWarehouseBatch
| at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
| at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
| at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
|
|
My client code DII:
| QName serviceName = new QName(
| "http://localhost:8080/nbric-business-appservices/WarehouseServiceBean?wsdl",
| "WarehouseServiceBeanService");
| ServiceFactory factory = ServiceFactory.newInstance();
| Service service = factory.createService(serviceName);
| Call call = service.createCall();
| QName operationName = new QName(BODY_NAMESPACE_VALUE,
| "searchPersonsForWarehouseBatch");
| call.setOperationName(operationName);
| call.setTargetEndpointAddress(endpoint);
| call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean(true));
| // call.setProperty(Call.SOAPACTION_URI_PROPERTY, "");
| call.setProperty(ENCODING_STYLE_PROPERTY, URI_ENCODING);
| QName QNAME_TYPE_STRING = new QName(NS_XSD, "string");
| call.setReturnType(QNAME_TYPE_STRING);
| call.setOperationName(new QName(BODY_NAMESPACE_VALUE,
| "searchPersonsForWarehouseBatch"));
|
| call.addParameter("String_1", QNAME_TYPE_STRING, ParameterMode.IN);
| String[] params = { "DEFAULTS13330" };
| // Invoke the WS operation using the JAX-RPC Call's invoke method
| String result = (String) call.invoke(params);
|
WSDL :
| - <definitions name="WarehouseServiceBeanService" targetNamespace="http://woss.appservice.nbric.nbpts.com/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://woss.appservice.nbric.nbpts.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
| - <types>
| - <xs:schema targetNamespace="http://woss.appservice.nbric.nbpts.com/" version="1.0" xmlns:tns="http://woss.appservice.nbric.nbpts.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
| <xs:element name="NBRICApplicationException" type="tns:NBRICApplicationException" />
| <xs:element name="NBRICSystemException" type="tns:NBRICSystemException" />
| <xs:element name="searchPersonsForWarehouseBatch" type="tns:searchPersonsForWarehouseBatch" />
| <xs:element name="searchPersonsForWarehouseBatchResponse" type="tns:searchPersonsForWarehouseBatchResponse" />
| - <xs:complexType name="searchPersonsForWarehouseBatch">
| - <xs:sequence>
| <xs:element minOccurs="0" name="arg0" type="xs:string" />
| </xs:sequence>
| </xs:complexType>
| - <xs:complexType name="searchPersonsForWarehouseBatchResponse">
| - <xs:sequence>
| <xs:element minOccurs="0" name="return" type="xs:string" />
| </xs:sequence>
| </xs:complexType>
| - <xs:complexType name="NBRICApplicationException">
| - <xs:sequence>
| <xs:element minOccurs="0" name="errorCode" type="xs:string" />
| <xs:element minOccurs="0" name="message" type="xs:string" />
| </xs:sequence>
| </xs:complexType>
| - <xs:complexType name="NBRICSystemException">
| - <xs:sequence>
| <xs:element minOccurs="0" name="errorCode" type="xs:string" />
| <xs:element minOccurs="0" name="message" type="xs:string" />
| </xs:sequence>
| </xs:complexType>
| </xs:schema>
| </types>
| - <message name="NBRICSystemException">
| <part element="tns:NBRICSystemException" name="NBRICSystemException" />
| </message>
| - <message name="NBRICApplicationException">
| <part element="tns:NBRICApplicationException" name="NBRICApplicationException" />
| </message>
| - <message name="WarehouseServiceBean_searchPersonsForWarehouseBatchResponse">
| <part element="tns:searchPersonsForWarehouseBatchResponse" name="searchPersonsForWarehouseBatchResponse" />
| </message>
| - <message name="WarehouseServiceBean_searchPersonsForWarehouseBatch">
| <part element="tns:searchPersonsForWarehouseBatch" name="searchPersonsForWarehouseBatch" />
| </message>
| - <portType name="WarehouseServiceBean">
| - <operation name="searchPersonsForWarehouseBatch" parameterOrder="searchPersonsForWarehouseBatch">
| <input message="tns:WarehouseServiceBean_searchPersonsForWarehouseBatch" />
| <output message="tns:WarehouseServiceBean_searchPersonsForWarehouseBatchResponse" />
| <fault message="tns:NBRICSystemException" name="NBRICSystemException" />
| <fault message="tns:NBRICApplicationException" name="NBRICApplicationException" />
| </operation>
| </portType>
| - <binding name="WarehouseServiceBeanBinding" type="tns:WarehouseServiceBean">
| <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
| - <operation name="searchPersonsForWarehouseBatch">
| <soap:operation soapAction="searchPersonsForWarehouseBatchAction" />
| - <input>
| <soap:body use="literal" />
| </input>
| - <output>
| <soap:body use="literal" />
| </output>
| - <fault name="NBRICSystemException">
| <soap:fault name="NBRICSystemException" use="literal" />
| </fault>
| - <fault name="NBRICApplicationException">
| <soap:fault name="NBRICApplicationException" use="literal" />
| </fault>
| </operation>
| </binding>
| - <service name="WarehouseServiceBeanService">
| - <port binding="tns:WarehouseServiceBeanBinding" name="WarehouseServiceBeanPort">
| <soap:address location="http://127.0.0.1:8080/nbric-business-appservices/WarehouseServiceBean" />
| </port>
| </service>
| </definitions>
|
The EJB 3 service:
| @Stateless(name = "WarehouseServiceBean", mappedName = "WarehouseServiceBean")
| @TransactionManagement(TransactionManagementType.CONTAINER)
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| @WebService
| public class WarehouseServiceBean implements /*WarehouseServiceInterface,*/ Serializable {
|
|
| /**
| *
| */
| private static final long serialVersionUID = 1L;
|
| public WarehouseServiceBean(){
|
| }
| @WebMethod(action="searchPersonsForWarehouseBatchAction" )
| public String searchPersonsForWarehouseBatch(
| String searchString
| )
| throws NBRICApplicationException, NBRICSystemException {
| List<Person> personList = null;
|
| try {
|
| /* - Commented the DAO code for time being.
|
|
|
| final PersonDAO dao = DAOFactory.getDAOFactory(
| ApplicationConstants.HIBERNATE_DAO_FACTORY).getPersonDAO();
| // Compass Search * Starts
| //personList = dao.searchPersonCompassPOC(searchString);
| // Compass Search * Ends
|
| // Hibernate search
| personList = dao.searchUserPOC(searchString);
|
| int arrayLength = personList.size();
| Person[] personArray = new Person[arrayLength];
| for (int i = 0; i < personArray.length; i++) {
| personArray
| = personList.get(i);
| }*/
|
|
|
|
|
| return "hello";
|
|
| /*} catch (NBRICApplicationException e) {
|
| throw e;
| } catch (NBRICSystemException e) {
| throw e;*/
|
| } catch (Exception e) {
| throw new NBRICSystemException(e, ErrorCode.S_SERVER_DOWN);
| }
| }
|
| }
|
Any help is really appreciated.
Thanks in advance.
- Gopi
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4223464#4223464
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4223464
15 years, 8 months