java consuming a iseries webservice - cant't figure out how to pass a string to a object class type

Skip to first unread message

joao dinis

Jan 6, 2021, 11:40:02 AMJan 6
I am an old rpg programmer and not very skilled with java, self learning but this one caught me and I need help solving this.

I have a webservice running on iseries that receives a string variable, my problem is pass this variable to the method that invokes the service, because it is not string or int or something like that, is a class type and here is the point.

My java is like this:

package jdws3;
import iseries.wsbeans.wsstk01a.xsd.WSSTK01AInput;
import iseries.wsbeans.wsstk01a.xsd.WSSTK01AResult;
import java.util.Scanner;
public class JdWS3 {
public static void main(String[] args) {
Scanner obj = new (;
System.out.println("Article Code: ");
String codart =;

WSSTK01AInput param0 = new WSSTK01AInput();

******** I tried in so many ways and don't figure how i can pass the variable 'codart' to param0 (type WSSTK01AInput) ********

System.out.println("Article name= "+wsstk01AXML(param0));
// this works and prints 'wrong article': <?xml version="1.0" encoding="UTF-8"?>
<ERRMSG>Artigo errado.</ERRMSG>


private static String wsstk01AXML(iseries.wsbeans.wsstk01a.xsd.WSSTK01AInput param0) {
iseries.wsbeans.wsstk01a.WSSTK01A service = new iseries.wsbeans.wsstk01a.WSSTK01A();
iseries.wsbeans.wsstk01a.WSSTK01APortType port = service.getWSSTK01ASOAP11PortHttp();
return port.wsstk01AXML(param0);

} // end of


package iseries.wsbeans.wsstk01a.xsd;

import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlType;

* <p>Java class for WSSTK01AInput complex type.
* <p>The following schema fragment specifies the expected content contained within this class.
* <pre>
* &lt;complexType name="WSSTK01AInput">
* &lt;complexContent>
* &lt;restriction base="{}anyType">
* &lt;sequence>
* &lt;element name="_CODART" type="{}string" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
@XmlType(name = "WSSTK01AInput", propOrder = {
public class WSSTK01AInput {

@XmlElementRef(name = "_CODART", namespace = "http://wsstk01a.wsbeans.iseries/xsd", type = JAXBElement.class, required = false)
protected JAXBElement<String> codart;

* Gets the value of the codart property.
* @return
* possible object is
* {@link JAXBElement }{@code <}{@link String }{@code >}
public JAXBElement<String> getCODART() {
return codart;

* Sets the value of the codart property.
* @param value
* allowed object is
* {@link JAXBElement }{@code <}{@link String }{@code >}
public void setCODART(JAXBElement<String> value) {
this.codart = value;


Reply all
Reply to author
0 new messages