Creating JAXBElement

oluşturmak için ilgili sınıfın schema targetName’i gereklidir veya ObjectFactory içerisinden zaten ilgili alan için metot oluşturulmuş olabilir ve bu metot ile JAXBElement oluşturabilirsiniz. QName erpCodeQName = new QName(“http://tempuri.org/”, “erpCode”); JAXBElement erpCodeJaxBElem = new JAXBElement(erpCodeQName, String.class, “123456”); setReversalERPCode.setErpCode(erpCodeJaxBElem); QName değerini almak için setReversalERPCode örneğinin sınıfına gidip aşağıdaki gibi property tanımlanmış olmalı. @XmlRootElement(name = “SetReversalERPCode”) public class SetReversalERPCode { @XmlElementRef(name = “erpCode”, namespace = “http://tempuri.org/”, type = JAXBElement.class, required = false) protected JAXBElement erpCode; } ObjectFactory örneği: com.ycn.eshop.core.ws.client.payment.ObjectFactory objFactory = new com.ycn.eshop.core.ws.client.payment.ObjectFactory(); com.ycn.eshop.core.ws.client.payment.AuthenticationInfo authInfo = new com.ycn.eshop.core.ws.client.payment.AuthenticationInfo(); JAXBElement authInfoUserNameJaxBElem = objFactory.createAuthenticationInfoUserName(“myusername”); authInfo.setUserName(authInfoUserNameJaxBElem); JAXBElement authInfoPasswordJaxBElem = objFactory.createAuthenticationInfoPassword(“mypassword”); authInfo.setPassword(authInfoPasswordJaxBElem); ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *