use of javax.wsdl.Output in project cxf by apache.
the class ServiceWSDLBuilderTest method testGreetMeOperation.
@Test
public void testGreetMeOperation() throws Exception {
setupWSDL(WSDL_PATH);
PortType portType = newDef.getPortType(new QName(newDef.getTargetNamespace(), "Greeter"));
Operation greetMe = portType.getOperation("greetMe", "greetMeRequest", "greetMeResponse");
assertNotNull(greetMe);
assertEquals("greetMe", greetMe.getName());
Input input = greetMe.getInput();
assertNotNull(input);
assertEquals("greetMeRequest", input.getName());
Message message = input.getMessage();
assertNotNull(message);
assertEquals("greetMeRequest", message.getQName().getLocalPart());
assertEquals(newDef.getTargetNamespace(), message.getQName().getNamespaceURI());
assertEquals(1, message.getParts().size());
assertEquals("in", message.getPart("in").getName());
Output output = greetMe.getOutput();
assertNotNull(output);
assertEquals("greetMeResponse", output.getName());
message = output.getMessage();
assertNotNull(message);
assertEquals("greetMeResponse", message.getQName().getLocalPart());
assertEquals(newDef.getTargetNamespace(), message.getQName().getNamespaceURI());
assertEquals(1, message.getParts().size());
assertEquals("out", message.getPart("out").getName());
assertEquals(0, greetMe.getFaults().size());
}
use of javax.wsdl.Output in project cxf by apache.
the class WSDLParameter method processWrappedOutputParams.
private void processWrappedOutputParams(WSDLToCorbaBinding wsdlToCorbaBinding, Operation operation, SchemaCollection xmlSchemaList, List<ParamType> inputs, List<ParamType> outputs) throws Exception {
Output output = operation.getOutput();
if (output != null) {
Message msg = output.getMessage();
Part part = (Part) msg.getOrderedParts(null).iterator().next();
XmlSchemaComplexType schemaType = null;
XmlSchemaElement el = getElement(part, xmlSchemaList);
if (el == null) {
return;
}
if (el.getSchemaType() != null) {
schemaType = (XmlSchemaComplexType) el.getSchemaType();
}
XmlSchemaSequence seq = (XmlSchemaSequence) schemaType.getParticle();
if (seq != null) {
for (XmlSchemaSequenceMember seqMember : seq.getItems()) {
if (seqMember instanceof XmlSchemaElement) {
el = (XmlSchemaElement) seqMember;
processWrappedOutputParam(wsdlToCorbaBinding, el, inputs, outputs);
}
}
}
}
}
use of javax.wsdl.Output in project cxf by apache.
the class WSDLParameter method processOutputParams.
private void processOutputParams(WSDLToCorbaBinding wsdlToCorbaBinding, Operation operation, SchemaCollection xmlSchemaList, List<ParamType> inputs, List<ParamType> outputs) throws Exception {
Output output = operation.getOutput();
if (output != null) {
Message msg = output.getMessage();
List<Part> parts = CastUtils.cast(msg.getOrderedParts(null));
for (Part part : parts) {
XmlSchemaType schemaType = null;
// check if in input list
String mode = "out";
ParamType paramtype = null;
boolean isObjectRef = isObjectReference(xmlSchemaList, part.getElementName());
for (int x = 0; x < inputs.size(); x++) {
paramtype = null;
ParamType d2 = inputs.get(x);
if (part.getElementName() != null && !isObjectRef) {
XmlSchemaElement el = getElement(part, xmlSchemaList);
if (el != null) {
if (el.getSchemaType() != null) {
schemaType = el.getSchemaType();
}
QName typeName = el.getSchemaTypeName();
if (typeName == null) {
typeName = el.getQName();
}
QName idltype = getIdlType(wsdlToCorbaBinding, schemaType, typeName, el.isNillable());
if ((d2.getName().equals(part.getName())) && (d2.getIdltype().equals(idltype))) {
inputs.remove(x);
paramtype = createParam(wsdlToCorbaBinding, "inout", part.getName(), idltype);
inputs.add(paramtype);
}
}
} else {
schemaType = getType(part, xmlSchemaList);
QName typeName = part.getTypeName();
if (isObjectRef) {
typeName = part.getElementName();
}
QName idltype = getIdlType(wsdlToCorbaBinding, schemaType, typeName, false);
if ((d2.getName().equals(part.getName())) && (d2.getIdltype().equals(idltype))) {
inputs.remove(x);
paramtype = createParam(wsdlToCorbaBinding, "inout", part.getName(), idltype);
inputs.add(paramtype);
}
}
}
if (paramtype == null) {
if (part.getElementName() != null && !isObjectRef) {
XmlSchemaElement el = getElement(part, xmlSchemaList);
QName typeName = el.getSchemaTypeName();
if (typeName == null) {
typeName = el.getQName();
}
QName idltype = getIdlType(wsdlToCorbaBinding, schemaType, typeName, el.isNillable());
paramtype = createParam(wsdlToCorbaBinding, mode, part.getName(), idltype);
} else {
QName typeName = part.getTypeName();
if (isObjectRef) {
typeName = part.getElementName();
}
QName idltype = getIdlType(wsdlToCorbaBinding, schemaType, typeName, false);
paramtype = createParam(wsdlToCorbaBinding, mode, part.getName(), idltype);
}
if (paramtype != null) {
outputs.add(paramtype);
}
}
}
}
}
use of javax.wsdl.Output in project cxf by apache.
the class OperationVisitor method generateOutputMessage.
public Message generateOutputMessage(Operation operation, BindingOperation bindingOperation) {
Message msg = definition.createMessage();
QName msgName;
if (!mapper.isDefaultMapping()) {
// mangle the message name
// REVISIT, do we put in the entire scope for mangling
msgName = new QName(definition.getTargetNamespace(), getScope().tail() + "." + operation.getName() + RESPONSE_SUFFIX);
} else {
msgName = new QName(definition.getTargetNamespace(), operation.getName() + RESPONSE_SUFFIX);
}
msg.setQName(msgName);
msg.setUndefined(false);
String outputName = operation.getName() + RESPONSE_SUFFIX;
Output output = definition.createOutput();
output.setName(outputName);
output.setMessage(msg);
BindingOutput bindingOutput = definition.createBindingOutput();
bindingOutput.setName(outputName);
bindingOperation.setBindingOutput(bindingOutput);
operation.setOutput(output);
definition.addMessage(msg);
return msg;
}
use of javax.wsdl.Output in project cxf by apache.
the class WSDLToSoapProcessor method validate.
private void validate() throws ToolException {
if (isBindingExisted()) {
Message msg = new Message("BINDING_ALREADY_EXIST", LOG);
throw new ToolException(msg);
}
if (!isPortTypeExisted()) {
Message msg = new Message("PORTTYPE_NOT_EXIST", LOG);
throw new ToolException(msg);
}
if (!nameSpaceCheck()) {
Message msg = new Message("SOAPBINDING_STYLE_NOT_PROVIDED", LOG);
throw new ToolException(msg);
}
if (WSDLConstants.RPC.equalsIgnoreCase((String) env.get(ToolConstants.CFG_STYLE))) {
Collection<Operation> ops = CastUtils.cast(portType.getOperations());
for (Operation op : ops) {
Input input = op.getInput();
if (input != null && input.getMessage() != null) {
Collection<Part> parts = CastUtils.cast(input.getMessage().getParts().values());
for (Part part : parts) {
if (part.getTypeName() == null || "".equals(part.getTypeName().toString())) {
Message msg = new Message("RPC_PART_ILLEGAL", LOG, new Object[] { part.getName() });
throw new ToolException(msg);
}
}
}
Output output = op.getOutput();
if (output != null && output.getMessage() != null) {
Collection<Part> parts = CastUtils.cast(output.getMessage().getParts().values());
for (Part part : parts) {
if (part.getTypeName() == null || "".equals(part.getTypeName().toString())) {
Message msg = new Message("RPC_PART_ILLEGAL", LOG, new Object[] { part.getName() });
throw new ToolException(msg);
}
}
}
}
}
}
Aggregations