You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by ev...@yandex.ru on 2009/08/10 15:15:16 UTC
Parameters from client are null at server
Hi I've created java webservice with .NET client with CXF. I have no problems with import of the WSDL to .NET client. But when I make some requests I see parameters in logged XML request. But when I check this parameters in the debugger there are nulls for all of them.
@WebParam(name="...") annotations were added, correct methods are invoked, but parameters are null.
How can I fix it? Thanks!
Re: Parameters from client are null at server
Posted by ev...@yandex.ru.
Daniel, is it enought, or I need to attach some additional data?
10.08.09, 18:37, "Daniel Kulp" <dk...@apache.org>:
> On Mon August 10 2009 9:15:16 am evilhare@yandex.ru wrote:
> > Hi I've created java webservice with .NET client with CXF. I have no
> > problems with import of the WSDL to .NET client. But when I make some
> > requests I see parameters in logged XML request. But when I check this
> > parameters in the debugger there are nulls for all of them.
> > @WebParam(name="...") annotations were added, correct methods are invoked,
> > but parameters are null. How can I fix it? Thanks!
> Can you attach the wsdl/schemas and the soap message? USUALLY, this is due to
> the incoming soap message not actually matching the schema.
--
Яндекс.Почта. Поищите спам где-нибудь еще http://mail.yandex.ru/nospam/sign
Re: Parameters from client are null at server
Posted by Daniel Kulp <dk...@apache.org>.
The message definitely looks ok there. Not sure what would be going on.
I'd probably need to see a testcase that shows the problem to really be able
to debug that.
Dan
On Mon August 10 2009 12:04:52 pm evilhare@yandex.ru wrote:
> Daniel, thanks for reply.
> WSDL is large, here is a part related to one method
> int[] getPermissionIdsByUserId(String userId)
>
> <?xml version='1.0' encoding='UTF-8'?><wsdl:definitions
> name="ServiceImplService"
> targetNamespace="http://WebServices.dbServices.a.com/"
> xmlns:ns1="http://cxf.apache.org/bindings/xformat"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:tns="http://WebServices.dbServices.a.com/"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <wsdl:types>
> <xsd:schema attributeFormDefault="qualified" elementFormDefault="qualified"
> targetNamespace="http://naming.javax" xmlns:ns0="http://lang.java"
> xmlns:ns1="http://util.java" xmlns:tns="http://naming.javax"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:import
> namespace="http://lang.java" />
> <xsd:import namespace="http://util.java" />
>
>
> <xsd:element name="getPermissionIdsByUserId"
> type="tns:getPermissionIdsByUserId"/> −
> <xsd:complexType name="getPermissionIdsByUserId">
> −
> <xsd:sequence>
> <xsd:element minOccurs="0" name="userId" type="xsd:string"/>
> </xsd:sequence>
> </xsd:complexType>
> <xsd:element name="getPermissionIdsByUserIdResponse"
> type="tns:getPermissionIdsByUserIdResponse"/> −
> <xsd:complexType name="getPermissionIdsByUserIdResponse">
> −
> <xsd:sequence>
> <xsd:element name="return" type="tns:ArrayOfInt"/>
> </xsd:sequence>
> </xsd:complexType>
>
> <wsdl:message name="getPermissionIdsByUserIdResponse">
> <wsdl:part element="tns:getPermissionIdsByUserIdResponse"
> name="parameters"> </wsdl:part>
> </wsdl:message>
>
> <wsdl:message name="getPermissionIdsByUserIdResponse">
> <wsdl:part element="tns:getPermissionIdsByUserIdResponse"
> name="parameters"> </wsdl:part>
> </wsdl:message>
>
> <wsdl:operation name="getPermissionIdsByUserId">
> <wsdl:input message="tns:getPermissionIdsByUserId"
> name="getPermissionIdsByUserId"> </wsdl:input>
> <wsdl:output message="tns:getPermissionIdsByUserIdResponse"
> name="getPermissionIdsByUserIdResponse"> </wsdl:output>
> </wsdl:operation>
>
> <wsdl:operation name="getPermissionIdsByUserId">
> <soap:operation soapAction="" style="document"/>
> −
> <wsdl:input name="getPermissionIdsByUserId">
> <soap:body use="literal"/>
> </wsdl:input>
> −
> <wsdl:output name="getPermissionIdsByUserIdResponse">
> <soap:body use="literal"/>
> </wsdl:output>
> </wsdl:operation>
>
>
> And here is a soap message from CXF logger:
>
> <?xml version="1.0" encoding="utf-8"?><soap:Envelope
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <soap:Body><getPermissionIdsByUserId
> xmlns="http://WebServices.dbServices.a.com">
> <userId>testuser</userId></getPermissionIdsByUserId>
> </soap:Body></soap:Envelope>
>
>
> instead of testuser I get null in java method.
> If you need additional information, please let me know.
>
> 10.08.09, 18:37, "Daniel Kulp" <dk...@apache.org>:
> > On Mon August 10 2009 9:15:16 am evilhare@yandex.ru wrote:
> > > Hi I've created java webservice with .NET client with CXF. I have no
> > > problems with import of the WSDL to .NET client. But when I make some
> > > requests I see parameters in logged XML request. But when I check this
> > > parameters in the debugger there are nulls for all of them.
> > > @WebParam(name="...") annotations were added, correct methods are
> > > invoked, but parameters are null. How can I fix it? Thanks!
> >
> > Can you attach the wsdl/schemas and the soap message? USUALLY, this is
> > due to the incoming soap message not actually matching the schema.
--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog
Re: Parameters from client are null at server
Posted by ev...@yandex.ru.
Daniel, thanks for reply.
WSDL is large, here is a part related to one method
int[] getPermissionIdsByUserId(String userId)
<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions name="ServiceImplService" targetNamespace="http://WebServices.dbServices.a.com/" xmlns:ns1="http://cxf.apache.org/bindings/xformat" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://WebServices.dbServices.a.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<xsd:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://naming.javax" xmlns:ns0="http://lang.java" xmlns:ns1="http://util.java" xmlns:tns="http://naming.javax" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://lang.java" />
<xsd:import namespace="http://util.java" />
<xsd:element name="getPermissionIdsByUserId" type="tns:getPermissionIdsByUserId"/>
−
<xsd:complexType name="getPermissionIdsByUserId">
−
<xsd:sequence>
<xsd:element minOccurs="0" name="userId" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="getPermissionIdsByUserIdResponse" type="tns:getPermissionIdsByUserIdResponse"/>
−
<xsd:complexType name="getPermissionIdsByUserIdResponse">
−
<xsd:sequence>
<xsd:element name="return" type="tns:ArrayOfInt"/>
</xsd:sequence>
</xsd:complexType>
<wsdl:message name="getPermissionIdsByUserIdResponse">
<wsdl:part element="tns:getPermissionIdsByUserIdResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getPermissionIdsByUserIdResponse">
<wsdl:part element="tns:getPermissionIdsByUserIdResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:operation name="getPermissionIdsByUserId">
<wsdl:input message="tns:getPermissionIdsByUserId" name="getPermissionIdsByUserId">
</wsdl:input>
<wsdl:output message="tns:getPermissionIdsByUserIdResponse" name="getPermissionIdsByUserIdResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getPermissionIdsByUserId">
<soap:operation soapAction="" style="document"/>
−
<wsdl:input name="getPermissionIdsByUserId">
<soap:body use="literal"/>
</wsdl:input>
−
<wsdl:output name="getPermissionIdsByUserIdResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
And here is a soap message from CXF logger:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body><getPermissionIdsByUserId xmlns="http://WebServices.dbServices.a.com">
<userId>testuser</userId></getPermissionIdsByUserId>
</soap:Body></soap:Envelope>
instead of testuser I get null in java method.
If you need additional information, please let me know.
10.08.09, 18:37, "Daniel Kulp" <dk...@apache.org>:
> On Mon August 10 2009 9:15:16 am evilhare@yandex.ru wrote:
> > Hi I've created java webservice with .NET client with CXF. I have no
> > problems with import of the WSDL to .NET client. But when I make some
> > requests I see parameters in logged XML request. But when I check this
> > parameters in the debugger there are nulls for all of them.
> > @WebParam(name="...") annotations were added, correct methods are invoked,
> > but parameters are null. How can I fix it? Thanks!
> Can you attach the wsdl/schemas and the soap message? USUALLY, this is due to
> the incoming soap message not actually matching the schema.
--
Новая Яндекс.Почта http://mail.yandex.ru/promo/neo/welcome/sign
Re: Parameters from client are null at server
Posted by Daniel Kulp <dk...@apache.org>.
On Mon August 10 2009 9:15:16 am evilhare@yandex.ru wrote:
> Hi I've created java webservice with .NET client with CXF. I have no
> problems with import of the WSDL to .NET client. But when I make some
> requests I see parameters in logged XML request. But when I check this
> parameters in the debugger there are nulls for all of them.
> @WebParam(name="...") annotations were added, correct methods are invoked,
> but parameters are null. How can I fix it? Thanks!
Can you attach the wsdl/schemas and the soap message? USUALLY, this is due to
the incoming soap message not actually matching the schema.
--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog
Re: Parameters from client are null at server
Posted by Daniel Kulp <dk...@apache.org>.
If you are getting into the getPara method, that means you don't have asm on
the classpath. Most likely, just putting asm on the classpath would fix
things for you.
That said, that probably also explains why I've never been able to reproduce
this. Is there any way to create a small test case that shows the issue?
Now that I know that asm cannot be there, I can probably debug better. I'm
curious as to why getConcreteName and getElementQName don't end up the same
for doc/lit/wrapped. They should be.
Dan
On Wed August 19 2009 6:10:30 am Sergey Pulyaev INTEGO wrote:
> evilhare@yandex.ru wrote:
> > Hi I've created java webservice with .NET client with CXF. I have no
> > problems with import of the WSDL to .NET client. But when I make some
> > requests I see parameters in logged XML request. But when I check this
> > parameters in the debugger there are nulls for all of them.
> > @WebParam(name="...") annotations were added, correct methods are
> > invoked, but parameters are null. How can I fix it? Thanks!
>
> I have this issue too.
> I solve it by modifying DocLiteralInInterceptor -
> function private void getPara() to allow parameters name resolution.
>
> I know this is not a good solution - but it works.
>
>
> private void getPara(DepthXMLStreamReader xmlReader,
> DataReader<XMLStreamReader> dr,
> MessageContentsList parameters,
> Iterator<MessagePartInfo> itr,
> Message message) {
>
> boolean hasNext = true;
> while (itr.hasNext()) {
> MessagePartInfo part = itr.next();
> if (hasNext) {
> hasNext = StaxUtils.toNextElement(xmlReader);
> }
> Object obj = null;
> if (hasNext) {
> QName rname = xmlReader.getName();
> while (part != null
> && !(rname.equals(part.getConcreteName()) ||
> rname.equals(part.getElementQName()))) {
> if (part.getXmlSchema() instanceof XmlSchemaElement) {
> //TODO - should check minOccurs=0 and throw
> validation exception
> //thing if the part needs to be here
> parameters.put(part, null);
> }
>
> if (itr.hasNext()) {
> part = itr.next();
> } else {
> part = null;
> }
> }
> if (part == null) {
> return;
> }
> if (rname.equals(part.getConcreteName()) ||
> rname.equals(part.getElementQName())) {
> obj = dr.read(part, xmlReader);
> }
> }
> parameters.put(part, obj);
> }
> }
>
> --------
> This data is for general information only and shall not be used to produce
> documents of any kind without same being submitted to, reviewed by, and
> approved by Intego in writing. All data is subject to change. User assumes
> all liability relating to the use of this data and agrees to release,
> indemnify, and hold harmless Intego from any and all claims relating said
> use. User is responsible to check for any viruses before use.
--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog
Re: Parameters from client are null at server
Posted by Sergey Pulyaev INTEGO <SP...@intego-group.com>.
evilhare@yandex.ru wrote:
> Hi I've created java webservice with .NET client with CXF. I have no problems with import of the WSDL to .NET client. But when I make some requests I see parameters in logged XML request. But when I check this parameters in the debugger there are nulls for all of them.
> @WebParam(name="...") annotations were added, correct methods are invoked, but parameters are null.
> How can I fix it? Thanks!
>
I have this issue too.
I solve it by modifying DocLiteralInInterceptor -
function private void getPara() to allow parameters name resolution.
I know this is not a good solution - but it works.
private void getPara(DepthXMLStreamReader xmlReader,
DataReader<XMLStreamReader> dr,
MessageContentsList parameters,
Iterator<MessagePartInfo> itr,
Message message) {
boolean hasNext = true;
while (itr.hasNext()) {
MessagePartInfo part = itr.next();
if (hasNext) {
hasNext = StaxUtils.toNextElement(xmlReader);
}
Object obj = null;
if (hasNext) {
QName rname = xmlReader.getName();
while (part != null
&& !(rname.equals(part.getConcreteName()) ||
rname.equals(part.getElementQName()))) {
if (part.getXmlSchema() instanceof XmlSchemaElement) {
//TODO - should check minOccurs=0 and throw
validation exception
//thing if the part needs to be here
parameters.put(part, null);
}
if (itr.hasNext()) {
part = itr.next();
} else {
part = null;
}
}
if (part == null) {
return;
}
if (rname.equals(part.getConcreteName()) ||
rname.equals(part.getElementQName())) {
obj = dr.read(part, xmlReader);
}
}
parameters.put(part, obj);
}
}
--------
This data is for general information only and shall not be used to produce documents of any kind without same being submitted to, reviewed by, and approved by Intego in writing. All data is subject to change. User assumes all liability relating to the use of this data and agrees to release, indemnify, and hold harmless Intego from any and all claims relating said use. User is responsible to check for any viruses before use.