JAX-WS Client request- xsi:type with the type having a namespace

JAX-WS Client request- xsi:type with the type having a namespace

 used JAXWS to generate web service client. When running client code, it produces following request-

view plaincopy to clipboardprint?
Note: Text content in the code blocks is automatically word-wrapped
<?xml version="1.0" encoding="UTF-8"?>  
<MyContainer xmlns:xsi="hxxp://www.w3.org/2001/XMLSchema-instance" xmlns="hxxp://www.model.example.com">  
    <aaa xsi:type="bbB" name="foo" attrFromB="bar" />  
    <aaa xsi:type="ccC" name="foo" attrFromC="bar" />  
</MyContainer> 
<?xml version="1.0" encoding="UTF-8"?>
<MyContainer xmlns:xsi="hxxp://www.w3.org/2001/XMLSchema-instance" xmlns="hxxp://www.model.example.com">
    <aaa xsi:type="bbB" name="foo" attrFromB="bar" />
    <aaa xsi:type="ccC" name="foo" attrFromC="bar" />
</MyContainer>
 

But i would like the request to look like-

view plaincopy to clipboardprint?
Note: Text content in the code blocks is automatically word-wrapped
<?xml version="1.0" encoding="UTF-8"?>  
<MyContainer xmlns:xsi="hxxp://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="hxxp://www.model.example.com">  
    <aaa xsi:type="ns1:bbB" name="foo" attrFromB="bar" />  
    <aaa xsi:type="ns1:ccC" name="foo" attrFromC="bar" />  
</MyContainer> 
<?xml version="1.0" encoding="UTF-8"?>
<MyContainer xmlns:xsi="hxxp://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="hxxp://www.model.example.com">
    <aaa xsi:type="ns1:bbB" name="foo" attrFromB="bar" />
    <aaa xsi:type="ns1:ccC" name="foo" attrFromC="bar" />
</MyContainer>

I want xsi:type value to have namespace, i.e. xsi:type="ns1:BbBType" What change should i do in java program for this to happen?
resolved. now creating object bbB using object factory rather than plain new bbB()

  • Back aarticle:
  • Next aarticle: No
  • Copyright © 2007-2012 www.chuibin.com Chuibin Copyright