Zdravim,
kedze jboss fisheye je mmntalne neskutocne pomaly, neposlem referenciu
ale rovno zdrojak v prilohe.
Ak je to to co hladate tak kompletnejsi sample sa nachadza v napr.
http://www.jboss.org/downloading/?projectId=jbossws&url=/jbossws/downloads/jbossws-native-3.0.2.GA.zip
Oto Buchta wrote / napĂsal(a):
Zdravim,
chtel bych se zeptat, jestli ma nekdo z vas zkusenosti s pouzitim raw servisy
v JBossu. Potrebuju naimplementovat WSDL popsane (a pozor, jenom na zaklade
ukazek SOAPovych obalek a XML Schematu, sic) v ISO/IEC 24730-1.
A protoze uz ono schema je priserne sprasene (podminky pro filter jsou zanorene do
jednoho elementu, procemz operace OR je udelana vlozenim elementu <OR/>
do seqence (bez <OR/> se implicitne dva po sobe jdouci podminky jakoby
mezi nimi byl AND), podivne pouziti soap-rpc Array,
vlastni xsd typ dateTimeWithTimezone,...), na mnoha mistech extendovatelne
pomoci specialniho tagu VendorSection, ale presto vsude sequence xsd:AnyType
a tudiz netrivialne prevoditelne do Java objektu, rozhodl jsem se servisu
naimplementovat pomoci Raw servisy.
Osobne ani nevim, zda JBossi SOAP stack neco takoveho primo
podporuje nebo zda je nutno nejak pouzit a ohnout Interceptor, ktery se
k SOAP Envelope dostane jako k celku. Resit to lze samozrejme cistym servletem,
ale prisel bych o moznost pouzit transparentne WS-Reliable Messaging
ci WS-Security. Proto mne zajima jakakoli vase zkusenost. Google taktne mlci.
Jako jedine reseni nabizi pouzit naportovani WASPu (SSJ) do AppServeru ;-)
Diky,
Oto 'tapik' Buchta
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.test.ws.jaxws.samples.provider;
// $Id: ProviderBeanPayload.java 5562 2008-02-04 19:30:40Z [EMAIL PROTECTED] $
import org.w3c.dom.Element;
import org.jboss.wsf.common.DOMUtils;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.io.IOException;
import javax.jws.HandlerChain;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import javax.xml.ws.Provider;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.WebServiceProvider;
/**
* Test a Provider<Source>
*
* @author [EMAIL PROTECTED]
* @since 29-Jun-2006
*/
@HandlerChain(file = "provider-handlers.xml")
@WebServiceProvider(serviceName = "ProviderService", portName = "ProviderPort",
targetNamespace = "http://org.jboss.ws/provider", wsdlLocation =
"WEB-INF/wsdl/Provider.wsdl")
// @ServiceMode(value = Service.Mode.PAYLOAD) - PAYLOAD is implicit
public class ProviderBeanPayload implements Provider<Source>
{
public Source invoke(Source req)
{
try
{
Transformer transformer =
TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
OutputStream out = new ByteArrayOutputStream();
StreamResult streamResult = new StreamResult();
streamResult.setOutputStream(out);
transformer.transform(req, streamResult);
String xmlReq = streamResult.getOutputStream().toString();
verifyRequest(xmlReq);
return new StreamSource(new ByteArrayInputStream(xmlReq.getBytes()));
}
catch (RuntimeException rte)
{
throw rte;
}
catch (Exception e)
{
throw new WebServiceException(e);
}
}
private void verifyRequest(String xml) throws IOException
{
Element was = DOMUtils.parse(xml);
if(!"somePayload".equals(was.getLocalName())
|| !"http://org.jboss.ws/provider".equals(was.getNamespaceURI())
|| !"Hello:Inbound:LogicalSourceHandler".equals(
DOMUtils.getTextContent(was)))
{
throw new WebServiceException("Unexpected payload: " + xml);
}
}
}