You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Roger P <ro...@gmail.com> on 2008/06/11 10:56:00 UTC

How do I get rid of xsi:type attributes?

I've googled but get either too many or too few hits. I'm forced to
use a set of products and they don't want to play with each other.

I've got this web service that I can successfully call using Soapui
but it fails when I use Axis 1.2.1. The code is generated by Borland
Jbuilder so I don't have that many configuration options (in the GUI
editor).

Anyway this is part of what the sever thinks is OK:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
	xmlns:xsd="http://fk.se/ICC/Integrations/I0021/BeraknaBostadsbidrag/xsd"
	xmlns:xsd1="http://fk.se/ICC/IntegrationsCommon/xsd">
   <soapenv:Header/>
   <soapenv:Body>
      <xsd:BeraknaBostadsbidragRequest>
<!-- snip -->
         <xsd:AntalBarnHemma>1</xsd:AntalBarnHemma>
<!-- snip -->
      </xsd:BeraknaBostadsbidragRequest>
   </soapenv:Body>
</soapenv:Envelope>


And this is what Axis sends (not accepted):
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body>
         <BeraknaBostadsbidragRequest
xmlns="http://fk.se/ICC/Integrations/I0021/BeraknaBostadsbidrag/xsd">
<!-- snip -->
            <AntalBarnHemma xsi:type="xsd:short">1</AntalBarnHemma>
<!-- snip -->
         </BeraknaBostadsbidragRequest>
      </soapenv:Body>
   </soapenv:Envelope>


The relevant part of the xsd:
<xs:element name="AntalBarnHemma">
<xs:simpleType>
	<xs:restriction base="xs:short">
	<xs:totalDigits value="1" />
  	<xs:minInclusive value="0" />
  	<xs:maxInclusive value="9" />
  	</xs:restriction>
</xs:simpleType>
</xs:element>

So how can I get Axis to use something similar to the accepted
version? If I intercept using TCPMonitor and remove
xsi:type="xsd:short" then it works. SEND_TYPE_ATTR is set to false.
WSDL element soap:body has attribute use="literal" so I tried
"wrapped" with setEncodingStyle.

Thanks!
Roger P

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: How do I get rid of xsi:type attributes?

Posted by Anne Thomas Manes <at...@gmail.com>.
Try naming your derived simpleType:

<xs:element name="AntalBarnHemma" type ="tns:AntaBarnHemmaType"/>
<xs:simpleType name="AnteBarnHemmaType">
       <xs:restriction base="xs:short">
       <xs:totalDigits value="1" />
       <xs:minInclusive value="0" />
       <xs:maxInclusive value="9" />
       </xs:restriction>
</xs:simpleType>

This will force Axis to generate a type for you, and then you cast the
short to this type.

Anne

On Thu, Jun 12, 2008 at 5:42 PM, Roger P
<ro...@gmail.com> wrote:
> On Wed, Jun 11, 2008 at 8:48 PM, David Ojeda <do...@integra.la> wrote:
>> Hello,
>>
>> I didn't notice you were using axis 1.2.1. Is axis generating a AntalBarnHemma
>> class? How do you set this? Could you send that piece of code?
>> I am guessing that BeraknaBostadsbidragRequest has a setAntalBarnHemma method
>> that receives a short, but perhaps there is a method that receives a
>> different object...
>
> Yes, there is a class and a setter that takes a short, all generated
> by Axis. The code isn't very interesting. It looks like something like
> this:
> myReq.setAntalBarnHemma((short) 1);
>
> There isn't any other method to set the value but there is a lot of
> configuration options and maybe there is some method that could be
> over ridden to change the XML that Axis generates.
>
> <AntalBarnHemma xsi:type="xsd:short">1</AntalBarnHemma>
>
> At the moment I'm leaning towards ditching Axis an use some simple XML
> templates. I did however find a possible explanation i this thread:
> http://www.mail-archive.com/axis-user@xml.apache.org/msg17417.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: How do I get rid of xsi:type attributes?

Posted by Roger P <ro...@gmail.com>.
On Wed, Jun 11, 2008 at 8:48 PM, David Ojeda <do...@integra.la> wrote:
> Hello,
>
> I didn't notice you were using axis 1.2.1. Is axis generating a AntalBarnHemma
> class? How do you set this? Could you send that piece of code?
> I am guessing that BeraknaBostadsbidragRequest has a setAntalBarnHemma method
> that receives a short, but perhaps there is a method that receives a
> different object...

Yes, there is a class and a setter that takes a short, all generated
by Axis. The code isn't very interesting. It looks like something like
this:
myReq.setAntalBarnHemma((short) 1);

There isn't any other method to set the value but there is a lot of
configuration options and maybe there is some method that could be
over ridden to change the XML that Axis generates.

<AntalBarnHemma xsi:type="xsd:short">1</AntalBarnHemma>

At the moment I'm leaning towards ditching Axis an use some simple XML
templates. I did however find a possible explanation i this thread:
http://www.mail-archive.com/axis-user@xml.apache.org/msg17417.html

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: How do I get rid of xsi:type attributes?

Posted by David Ojeda <do...@integra.la>.
Hello,

I didn't notice you were using axis 1.2.1. Is axis generating a AntalBarnHemma 
class? How do you set this? Could you send that piece of code?
I am guessing that BeraknaBostadsbidragRequest has a setAntalBarnHemma method 
that receives a short, but perhaps there is a method that receives a 
different object...

On Wednesday 11 June 2008 10:19:10 am Roger P wrote:
> Hi,
>
> On 6/11/08, David Ojeda <do...@integra.la> wrote:
> > Hello,
> >
> > I am sorry I am not replying because I can help you. I was just wondering
> > where do you set this SEND_TYPE_ATTR?
>
> First I'm using Axis 1.2.1 so I don't know if this applies to your
> problem. I'm setting it on my org.apache.axis.client.Call. It's auto
> generated:
> _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,
> Boolean.FALSE);
>
> > Anyway, back to your problem, could you please explain why the xml that
> > axis sends is "not accepted" ? Is there an exception perhaps? SoapUI has
> > an error log if this is the case...
>
> I get an internal error in the integration server we are using:
>  error: Type 'T=short@http://www.w3.org/2001/XMLSchema' is not derived
> from
> 'E=AntalBarnHemma|T=BeraknaBostadsbidragRequestType@http://fk.se/ICC/Integr
>ations/I0021/BeraknaBostadsbidrag/xsd'
>
> I can't change the server to fix this so I have to do something with the
> client.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org



-- 
Ing. David Ojeda
Integra Consultores
+58 416 6262898
Caracas, Venezuela

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: How do I get rid of xsi:type attributes?

Posted by Roger P <ro...@gmail.com>.
Hi,

On 6/11/08, David Ojeda <do...@integra.la> wrote:
> Hello,
>
> I am sorry I am not replying because I can help you. I was just wondering
> where do you set this SEND_TYPE_ATTR?
First I'm using Axis 1.2.1 so I don't know if this applies to your
problem. I'm setting it on my org.apache.axis.client.Call. It's auto
generated:
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);

>
> Anyway, back to your problem, could you please explain why the xml that axis
> sends is "not accepted" ? Is there an exception perhaps? SoapUI has an error
> log if this is the case...

I get an internal error in the integration server we are using:
 error: Type 'T=short@http://www.w3.org/2001/XMLSchema' is not derived
from 'E=AntalBarnHemma|T=BeraknaBostadsbidragRequestType@http://fk.se/ICC/Integrations/I0021/BeraknaBostadsbidrag/xsd'

I can't change the server to fix this so I have to do something with the client.

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: How do I get rid of xsi:type attributes?

Posted by David Ojeda <do...@integra.la>.
Hello,

I am sorry I am not replying because I can help you. I was just wondering 
where do you set this SEND_TYPE_ATTR? I am having some trouble with xsd 
polymorphism and axis2+xmlbeans. So my problem is exactly the opposite, I 
need the xsi:types, but axis2 is not generating it.

Anyway, back to your problem, could you please explain why the xml that axis 
sends is "not accepted" ? Is there an exception perhaps? SoapUI has an error 
log if this is the case...



On Wednesday 11 June 2008 04:26:00 am Roger P wrote:
> I've googled but get either too many or too few hits. I'm forced to
> use a set of products and they don't want to play with each other.
>
> I've got this web service that I can successfully call using Soapui
> but it fails when I use Axis 1.2.1. The code is generated by Borland
> Jbuilder so I don't have that many configuration options (in the GUI
> editor).
>
> Anyway this is part of what the sever thinks is OK:
>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> 	xmlns:xsd="http://fk.se/ICC/Integrations/I0021/BeraknaBostadsbidrag/xsd"
> 	xmlns:xsd1="http://fk.se/ICC/IntegrationsCommon/xsd">
>    <soapenv:Header/>
>    <soapenv:Body>
>       <xsd:BeraknaBostadsbidragRequest>
> <!-- snip -->
>          <xsd:AntalBarnHemma>1</xsd:AntalBarnHemma>
> <!-- snip -->
>       </xsd:BeraknaBostadsbidragRequest>
>    </soapenv:Body>
> </soapenv:Envelope>
>
>
> And this is what Axis sends (not accepted):
>    <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>       <soapenv:Body>
>          <BeraknaBostadsbidragRequest
> xmlns="http://fk.se/ICC/Integrations/I0021/BeraknaBostadsbidrag/xsd">
> <!-- snip -->
>             <AntalBarnHemma xsi:type="xsd:short">1</AntalBarnHemma>
> <!-- snip -->
>          </BeraknaBostadsbidragRequest>
>       </soapenv:Body>
>    </soapenv:Envelope>
>
>
> The relevant part of the xsd:
> <xs:element name="AntalBarnHemma">
> <xs:simpleType>
> 	<xs:restriction base="xs:short">
> 	<xs:totalDigits value="1" />
>   	<xs:minInclusive value="0" />
>   	<xs:maxInclusive value="9" />
>   	</xs:restriction>
> </xs:simpleType>
> </xs:element>
>
> So how can I get Axis to use something similar to the accepted
> version? If I intercept using TCPMonitor and remove
> xsi:type="xsd:short" then it works. SEND_TYPE_ATTR is set to false.
> WSDL element soap:body has attribute use="literal" so I tried
> "wrapped" with setEncodingStyle.
>
> Thanks!
> Roger P
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org



-- 
Ing. David Ojeda
Integra Consultores
+58 416 6262898
Caracas, Venezuela

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org