Hi
all,
I'm trying to define
a non-anonymous, custom complex type so that I can pass it as a single request
parameter. But, I am running into some problems. My custom type is defined
as:
<xsd:schema
elementFormDefault="qualified"
targetNamespace="http://cisco.com/muse/demo/cap/box">
<xsd:complexType name="BoxType">
<xsd:sequence>
<xsd:element name="width" type="xsd:integer"/>
<xsd:element name="height" type="xsd:integer"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="BoxOperation" type="box:BoxType" />
<xsd:element name="BoxOperationResponse" type="box:BoxType" />
</xsd:schema>
elementFormDefault="qualified"
targetNamespace="http://cisco.com/muse/demo/cap/box">
<xsd:complexType name="BoxType">
<xsd:sequence>
<xsd:element name="width" type="xsd:integer"/>
<xsd:element name="height" type="xsd:integer"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="BoxOperation" type="box:BoxType" />
<xsd:element name="BoxOperationResponse" type="box:BoxType" />
</xsd:schema>
The java code for my
operation is:
public Element boxOperation(Element param1) throws
Exception
{
BoxOperationDocument doc = BoxOperationDocument.Factory.parse(param1.getParentNode());
BoxType type = doc.getBoxOperation();
type.setWidth(type.getWidth().add(BigInteger.valueOf(100)));
type.setHeight(type.getHeight().add(BigInteger.valueOf(100)));
return XmlUtils.getFirstElement(doc.getDomNode());
}
{
BoxOperationDocument doc = BoxOperationDocument.Factory.parse(param1.getParentNode());
BoxType type = doc.getBoxOperation();
type.setWidth(type.getWidth().add(BigInteger.valueOf(100)));
type.setHeight(type.getHeight().add(BigInteger.valueOf(100)));
return XmlUtils.getFirstElement(doc.getDomNode());
}
The client code
is:
public String testBoxOperation()
throws SoapFault
{
BoxOperationDocument doc = BoxOperationDocument.Factory.newInstance();
BoxType box = doc.addNewBoxOperation();
box.setWidth(BigInteger.valueOf(555));
box.setHeight(BigInteger.valueOf(555));
Element param1 = XmlUtils.getFirstElement(doc.getDomNode());
throws SoapFault
{
BoxOperationDocument doc = BoxOperationDocument.Factory.newInstance();
BoxType box = doc.addNewBoxOperation();
box.setWidth(BigInteger.valueOf(555));
box.setHeight(BigInteger.valueOf(555));
Element param1 = XmlUtils.getFirstElement(doc.getDomNode());
Element body = XmlUtils.createElement(IBoxCapability.OP_QNAME,
param1);
Element response = invoke(IBoxCapability.OP_URI, body);
return XmlUtils.extractText(response);
}
Element response = invoke(IBoxCapability.OP_URI, body);
return XmlUtils.extractText(response);
}
I am expecting to
pass a single object in the request, but I am getting an error indicating that
two parameters are expected, not one. Attached is the stack trace.
Can anyone tell me what I'm doing wrong?
-Vinh
[CLIENT TRACE] SOAP envelope contents (outgoing): <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> <soap:Header> <wsa:To xmlns:wsa="http://www.w3.org/2005/08/addressing">http://171.69.71.120:8080/MuseDemo/services/SimpleResource</wsa:To> <wsa:Action xmlns:wsa="http://www.w3.org/2005/08/addressing">http://cisco.com/muse/demo/cap/first/FirstOperation</wsa:Action> <wsa:MessageID xmlns:wsa="http://www.w3.org/2005/08/addressing">uuid:fcbaf5d9-4117-ec43-5cf3-ccd7eb08a9c9</wsa:MessageID> <wsa:From xmlns:wsa="http://www.w3.org/2005/08/addressing"> <wsa:Address>http://www.w3.org/2005/08/addressing/role/anonymous</wsa:Address> </wsa:From> <muse-wsa:ResourceId xmlns:muse-wsa="http://ws.apache.org/muse/addressing" xmlns:wsa="http://www.w3.org/2005/08/addressing" wsa:IsReferenceParameter="true">MuseResource-1</muse-wsa:ResourceId> </soap:Header> <soap:Body> <first:FirstOperation xmlns:first="http://cisco.com/muse/demo/cap/first">Hello, World!</first:FirstOperation> </soap:Body> </soap:Envelope>
[CLIENT TRACE] SOAP envelope contents (incoming):
<soapenv:Envelope
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
xmlns:wsa="http://www.w3.org/2005/08/addressing">
<soapenv:Header>
<wsa:To>http://www.w3.org/2005/08/addressing/anonymous</wsa:To>
<wsa:ReplyTo>
<wsa:Address>http://www.w3.org/2005/08/addressing/none</wsa:Address>
</wsa:ReplyTo>
<wsa:MessageID>urn:uuid:195345E82138278232116226100429524</wsa:MessageID>
<wsa:Action>http://cisco.com/muse/demo/cap/first/FirstOperation</wsa:Action>
<wsa:RelatesTo
wsa:RelationshipType="http://www.w3.org/2005/08/addressing/reply">uuid:fcbaf5d9-4117-ec43-5cf3-ccd7eb08a9c9</wsa:RelatesTo>
</soapenv:Header>
<soapenv:Body>
<muse-op:FirstOperationResponse
xmlns:muse-op="http://cisco.com/muse/demo/cap/first"
xmlns:tns="http://ws.apache.org/axis2">[RESPONSE] Hello,
World!</muse-op:FirstOperationResponse>
</soapenv:Body>
</soapenv:Envelope>
[CLIENT TRACE] SOAP envelope contents (outgoing):
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>
<wsa:To
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://171.69.71.120:8080/MuseDemo/services/SimpleResource</wsa:To>
<wsa:Action
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://cisco.com/muse/demo/cap/second/SecondOperation</wsa:Action>
<wsa:MessageID
xmlns:wsa="http://www.w3.org/2005/08/addressing">uuid:180bb1a1-c553-4d94-a54e-92d7c6d0d152</wsa:MessageID>
<wsa:From xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Address>http://www.w3.org/2005/08/addressing/role/anonymous</wsa:Address>
</wsa:From>
<muse-wsa:ResourceId
xmlns:muse-wsa="http://ws.apache.org/muse/addressing"
xmlns:wsa="http://www.w3.org/2005/08/addressing"
wsa:IsReferenceParameter="true">MuseResource-1</muse-wsa:ResourceId>
</soap:Header>
<soap:Body>
<second:SecondOperation
xmlns:second="http://cisco.com/muse/demo/cap/second"
xmlns:ibm="http://ibm.com">
<second:Param1>42</second:Param1>
<second:Param2>ibm:Test</second:Param2>
</second:SecondOperation>
</soap:Body>
</soap:Envelope>
[CLIENT TRACE] SOAP envelope contents (incoming):
<soapenv:Envelope
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
xmlns:wsa="http://www.w3.org/2005/08/addressing">
<soapenv:Header>
<wsa:To>http://www.w3.org/2005/08/addressing/anonymous</wsa:To>
<wsa:ReplyTo>
<wsa:Address>http://www.w3.org/2005/08/addressing/none</wsa:Address>
</wsa:ReplyTo>
<wsa:MessageID>urn:uuid:195345E82138278232116226100434126</wsa:MessageID>
<wsa:Action>http://cisco.com/muse/demo/cap/second/SecondOperation</wsa:Action>
<wsa:RelatesTo
wsa:RelationshipType="http://www.w3.org/2005/08/addressing/reply">uuid:180bb1a1-c553-4d94-a54e-92d7c6d0d152</wsa:RelatesTo>
</soapenv:Header>
<soapenv:Body>
<muse-op:SecondOperationResponse
xmlns:muse-op="http://cisco.com/muse/demo/cap/second"
xmlns:tns="http://ws.apache.org/axis2">true</muse-op:SecondOperationResponse>
</soapenv:Body>
</soapenv:Envelope>
[CLIENT TRACE] SOAP envelope contents (outgoing):
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>
<wsa:To
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://171.69.71.120:8080/MuseDemo/services/SimpleResource</wsa:To>
<wsa:Action
xmlns:wsa="http://www.w3.org/2005/08/addressing">http://cisco.com/muse/demo/cap/box/BoxOperation</wsa:Action>
<wsa:MessageID
xmlns:wsa="http://www.w3.org/2005/08/addressing">uuid:f57a2b20-8ddf-1f30-b19b-c2ddabc2ce38</wsa:MessageID>
<wsa:From xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Address>http://www.w3.org/2005/08/addressing/role/anonymous</wsa:Address>
</wsa:From>
<muse-wsa:ResourceId
xmlns:muse-wsa="http://ws.apache.org/muse/addressing"
xmlns:wsa="http://www.w3.org/2005/08/addressing"
wsa:IsReferenceParameter="true">MuseResource-1</muse-wsa:ResourceId>
</soap:Header>
<soap:Body>
<box:BoxOperation xmlns:box="http://cisco.com/muse/demo/cap/box">
<width xmlns="http://cisco.com/muse/demo/cap/box">555</width>
<height xmlns="http://cisco.com/muse/demo/cap/box">555</height>
</box:BoxOperation>
</soap:Body>
</soap:Envelope>
[CLIENT TRACE] SOAP envelope contents (incoming):
<soapenv:Envelope
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
xmlns:wsa="http://www.w3.org/2005/08/addressing">
<soapenv:Header>
<wsa:To>http://www.w3.org/2005/08/addressing/anonymous</wsa:To>
<wsa:ReplyTo>
<wsa:Address>http://www.w3.org/2005/08/addressing/none</wsa:Address>
</wsa:ReplyTo>
<wsa:MessageID>urn:uuid:195345E82138278232116226100476328</wsa:MessageID>
<wsa:Action>http://cisco.com/muse/demo/cap/box/BoxOperation</wsa:Action>
<wsa:RelatesTo
wsa:RelationshipType="http://www.w3.org/2005/08/addressing/reply">uuid:f57a2b20-8ddf-1f30-b19b-c2ddabc2ce38</wsa:RelatesTo>
</soapenv:Header>
<soapenv:Body>
<soap:Fault xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:tns="http://ws.apache.org/axis2">
<soap:Code>
<soap:Value>soap:Receiver</soap:Value>
</soap:Code>
<soap:Reason>
<soap:Text>[ID = 'IncorrectParams'] The target method
'boxOperation' expected 1 parameters, but the caller sent 2.</soap:Text>
</soap:Reason>
</soap:Fault>
</soapenv:Body>
</soapenv:Envelope>
org.apache.muse.ws.addressing.soap.SoapFault: [ID = 'IncorrectParams'] The
target method 'boxOperation' expected 1 parameters, but the caller sent 2.
at
org.apache.muse.core.AbstractResourceClient.invoke(AbstractResourceClient.java:254)
at
com.cisco.muse.demo.SimpleResourceClient.boxOperation(SimpleResourceClient.java:100)
at com.cisco.muse.demo.SimpleTestClient.main(SimpleTestClient.java:95)
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
