public void accept(WSDLDocumentVisitor visitor) throws Exception { visitor.preVisit(this); for (Iterator<MessagePart> iter = _parts.iterator(); iter.hasNext();) { iter.next().accept(visitor); } visitor.postVisit(this); }
public void validateThis() { if(_descriptor != null && _descriptor.getLocalPart().equals("")){ failValidation("validation.invalidElement", _descriptor.toString()); } }
public static boolean isUnbound(MessagePart part) { if((part != null) && part.getBindingExtensibilityElementKind() == MessagePart.PART_NOT_BOUNDED) return true; return false; } }
public void add(MessagePart part) { if (_partsByName.get(part.getName()) != null){ errorReceiver.error(part.getLocator(), WsdlMessages.VALIDATION_DUPLICATE_PART_NAME(getName(), part.getName())); throw new AbortException(); } if(part.getDescriptor() != null && part.getDescriptorKind() != null) { _partsByName.put(part.getName(), part); _parts.add(part); } else errorReceiver.warning(part.getLocator(), WsdlMessages.PARSING_ELEMENT_OR_TYPE_REQUIRED(part.getName())); }
Parameter param = null; if (ModelerUtils.isBoundToSOAPBody(part)) { if (part.isIN()) { param = ModelerUtils.getParameter(part.getName(), inParams); } else if (outParams != null) { param = ModelerUtils.getParameter(part.getName(), outParams); QName headerName = part.getDescriptor(); JAXBType jaxbType = getJAXBType(part); Block headerBlock = new Block(headerName, jaxbType, part); param = ModelerUtils.createParameter(part.getName(), jaxbType, headerBlock); if (part.isIN()) { req.addHeaderBlock(headerBlock); } else if (part.isOUT()) { res.addHeaderBlock(headerBlock); } else if (part.isINOUT()) { req.addHeaderBlock(headerBlock); res.addHeaderBlock(headerBlock); if (part.isIN() || part.isINOUT()) { mimeContents = getMimeContents(info.bindingOperation.getInput(), getInputMessage(), part.getName()); } else { mimeContents = getMimeContents(info.bindingOperation.getOutput(), getOutputMessage(), part.getName()); param = ModelerUtils.createParameter(part.getName(), type, mimeBlock); if (part.isIN()) { req.addAttachmentBlock(mimeBlock);
if(p.getDescriptorKind() == SchemaKinds.XSD_ELEMENT){ print("<xs:element ref=''types:{0}'' xmlns:types=''{1}''/>",p.getDescriptor().getLocalPart(), p.getDescriptor().getNamespaceURI()); }else{ print("<xs:element name=''{0}'' type=''{1}'' xmlns=''{2}'' />", p.getName(), p.getDescriptor().getLocalPart(), p.getDescriptor().getNamespaceURI() );
private MessagePart parseMessagePart(TWSDLParserContextImpl context, Element e) { context.push(); context.registerNamespaces(e); MessagePart part = new MessagePart(forest.locatorTable.getStartLocation(e)); String partName = Util.getRequiredAttribute(e, Constants.ATTR_NAME); part.setName(partName); String elementAttr = XmlUtil.getAttributeOrNull(e, Constants.ATTR_ELEMENT); String typeAttr = XmlUtil.getAttributeOrNull(e, Constants.ATTR_TYPE); if (elementAttr != null) { if (typeAttr != null) { errReceiver.error(context.getLocation(e), WsdlMessages.PARSING_ONLY_ONE_OF_ELEMENT_OR_TYPE_REQUIRED(partName)); } part.setDescriptor(context.translateQualifiedName(context.getLocation(e), elementAttr)); part.setDescriptorKind(SchemaKinds.XSD_ELEMENT); } else if (typeAttr != null) { part.setDescriptor(context.translateQualifiedName(context.getLocation(e), typeAttr)); part.setDescriptorKind(SchemaKinds.XSD_TYPE); } else { // XXX-NOTE - this is wrong; for extensibility purposes, // any attribute can be specified on a <part> element, so // we need to put an extensibility hook here errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ELEMENT_OR_TYPE_REQUIRED(partName)); } context.pop(); context.fireDoneParsingEntity(WSDLConstants.QNAME_PART, part); return part; }
protected boolean isSingleInOutPart(Set inputParameterNames, MessagePart outputPart) { // As of now, we dont have support for in/out in doc-lit. So return false. SOAPOperation soapOperation = (SOAPOperation) getExtensionOfType(info.bindingOperation, SOAPOperation.class); if ((soapOperation != null) && (soapOperation.isDocument() || info.soapBinding.isDocument())) { Iterator iter = getInputMessage().parts(); while (iter.hasNext()) { MessagePart part = (MessagePart) iter.next(); if (outputPart.getName().equals(part.getName()) && outputPart.getDescriptor().equals(part.getDescriptor())) { return true; } } } else if (soapOperation != null && soapOperation.isRPC() || info.soapBinding.isRPC()) { com.sun.tools.ws.wsdl.document.Message inputMessage = getInputMessage(); if (inputParameterNames.contains(outputPart.getName())) { if (inputMessage.getPart(outputPart.getName()).getDescriptor().equals(outputPart.getDescriptor())) { return true; } } } return false; }
public static List<Parameter> createRpcLitParameters(Message message, Block block, S2JJAXBModel jaxbModel, ErrorReceiverFilter errReceiver){ RpcLitStructure rpcStruct = (RpcLitStructure)block.getType(); List<Parameter> parameters = new ArrayList<Parameter>(); for(MessagePart part : message.getParts()){ if(!ModelerUtils.isBoundToSOAPBody(part)) continue; QName name = part.getDescriptor(); TypeAndAnnotation typeAndAnn = jaxbModel.getJavaType(name); if(typeAndAnn == null){ String msgQName = "{"+message.getDefining().getTargetNamespaceURI()+"}"+message.getName(); errReceiver.error(part.getLocator(), ModelerMessages.WSDLMODELER_RPCLIT_UNKOWNSCHEMATYPE(name.toString(), part.getName(), msgQName)); throw new AbortException(); } String type = typeAndAnn.getTypeClass().fullName(); type = ClassNameInfo.getGenericClass(type); RpcLitMember param = new RpcLitMember(new QName("", part.getName()), type); JavaType javaType = new JavaSimpleType(new JAXBTypeAndAnnotation(typeAndAnn)); param.setJavaType(javaType); rpcStruct.addRpcLitMember(param); Parameter parameter = ModelerUtils.createParameter(part.getName(), param, block); parameter.setEmbedded(true); parameters.add(parameter); } return parameters; }
error(header, ModelerMessages.WSDLMODELER_INVALID_HEADER_NOT_FOUND(header.getPart(), bindingOperation.getName())); if (part.getDescriptorKind() != SchemaKinds.XSD_ELEMENT) { if (options.isExtensionMode()) { warning(part, ModelerMessages.WSDLMODELER_INVALID_HEADER_MESSAGE_PART_MUST_HAVE_ELEMENT_DESCRIPTOR(part.getName(), bindingOperation.getName())); } else { error(part, ModelerMessages.WSDLMODELER_INVALID_HEADER_MESSAGE_PART_MUST_HAVE_ELEMENT_DESCRIPTOR(part.getName(), bindingOperation.getName())); part.setBindingExtensibilityElementKind(MessagePart.SOAP_HEADER_BINDING); parts.add(part);
if ((inputPart != null && !inputPart.getDescriptor().getLocalPart().equals(operationName)) || (outputPart != null && outputPart.getDescriptorKind() != SchemaKinds.XSD_ELEMENT)) { return false; if (((inputPart != null) && (inputPart.getBindingExtensibilityElementKind() != MessagePart.SOAP_BODY_BINDING)) || ((outputPart != null) && (outputPart.getBindingExtensibilityElementKind() != MessagePart.SOAP_BODY_BINDING))) { return false;
public Parameter(String name, Entity entity) { super(entity); this.name = name; if(entity instanceof com.sun.tools.ws.wsdl.document.Message){ this.entityName = ((com.sun.tools.ws.wsdl.document.Message)entity).getName(); }else if(entity instanceof MessagePart){ this.entityName = ((MessagePart)entity).getName(); }else{ this.entityName = name; } }
/** * For Document/Lit the wsdl:part should only have element attribute and * for RPC/Lit or RPC/Encoded the wsdl:part should only have type attribute * inside wsdl:message. */ protected boolean isStyleAndPartMatch( SOAPOperation soapOperation, MessagePart part) { // style attribute on soap:operation takes precedence over the // style attribute on soap:binding if ((soapOperation != null) && (soapOperation.getStyle() != null)) { if ((soapOperation.isDocument() && (part.getDescriptorKind() != SchemaKinds.XSD_ELEMENT)) || (soapOperation.isRPC() && (part.getDescriptorKind() != SchemaKinds.XSD_TYPE))) { return false; } } else { if ((info.soapBinding.isDocument() && (part.getDescriptorKind() != SchemaKinds.XSD_ELEMENT)) || (info.soapBinding.isRPC() && (part.getDescriptorKind() != SchemaKinds.XSD_TYPE))) { return false; } } return true; }
private void writeImports(QName elementName, List<MessagePart> parts){ Set<String> uris = new HashSet<String>(); for(MessagePart p:parts){ String ns = p.getDescriptor().getNamespaceURI(); if(!uris.contains(ns) && !ns.equals("http://www.w3.org/2001/XMLSchema") && !ns.equals(elementName.getNamespaceURI())){ print("<xs:import namespace=''{0}''/>", ns); uris.add(ns); } } }
Parameter param = null; if (ModelerUtils.isBoundToSOAPBody(part)) { if (part.isIN()) { param = ModelerUtils.getParameter(part.getName(), inParams); } else if (outParams != null) { param = ModelerUtils.getParameter(part.getName(), outParams); QName headerName = part.getDescriptor(); JAXBType jaxbType = getJAXBType(part); Block headerBlock = new Block(headerName, jaxbType, part); param = ModelerUtils.createParameter(part.getName(), jaxbType, headerBlock); if (part.isIN()) { req.addHeaderBlock(headerBlock); } else if (part.isOUT()) { res.addHeaderBlock(headerBlock); } else if (part.isINOUT()) { req.addHeaderBlock(headerBlock); res.addHeaderBlock(headerBlock); if (part.isIN() || part.isINOUT()) { mimeContents = getMimeContents(info.bindingOperation.getInput(), getInputMessage(), part.getName()); } else { mimeContents = getMimeContents(info.bindingOperation.getOutput(), getOutputMessage(), part.getName()); param = ModelerUtils.createParameter(part.getName(), type, mimeBlock); if (part.isIN()) { req.addAttachmentBlock(mimeBlock);
if(p.getDescriptorKind() == SchemaKinds.XSD_ELEMENT){ print("<xs:element ref=''types:{0}'' xmlns:types=''{1}''/>",p.getDescriptor().getLocalPart(), p.getDescriptor().getNamespaceURI()); }else{ print("<xs:element name=''{0}'' type=''{1}'' xmlns=''{2}'' />", p.getName(), p.getDescriptor().getLocalPart(), p.getDescriptor().getNamespaceURI() );
public void add(MessagePart part) { if (_partsByName.get(part.getName()) != null){ errorReceiver.error(part.getLocator(), WsdlMessages.VALIDATION_DUPLICATE_PART_NAME(getName(), part.getName())); throw new AbortException(); } if(part.getDescriptor() != null && part.getDescriptorKind() != null) { _partsByName.put(part.getName(), part); _parts.add(part); } else errorReceiver.warning(part.getLocator(), WsdlMessages.PARSING_ELEMENT_OR_TYPE_REQUIRED(part.getName())); }
private MessagePart parseMessagePart(TWSDLParserContextImpl context, Element e) { context.push(); context.registerNamespaces(e); MessagePart part = new MessagePart(forest.locatorTable.getStartLocation(e)); String partName = Util.getRequiredAttribute(e, Constants.ATTR_NAME); part.setName(partName); String elementAttr = XmlUtil.getAttributeOrNull(e, Constants.ATTR_ELEMENT); String typeAttr = XmlUtil.getAttributeOrNull(e, Constants.ATTR_TYPE); if (elementAttr != null) { if (typeAttr != null) { errReceiver.error(context.getLocation(e), WsdlMessages.PARSING_ONLY_ONE_OF_ELEMENT_OR_TYPE_REQUIRED(partName)); } part.setDescriptor(context.translateQualifiedName(context.getLocation(e), elementAttr)); part.setDescriptorKind(SchemaKinds.XSD_ELEMENT); } else if (typeAttr != null) { part.setDescriptor(context.translateQualifiedName(context.getLocation(e), typeAttr)); part.setDescriptorKind(SchemaKinds.XSD_TYPE); } else { // XXX-NOTE - this is wrong; for extensibility purposes, // any attribute can be specified on a <part> element, so // we need to put an extensibility hook here errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ELEMENT_OR_TYPE_REQUIRED(partName)); } context.pop(); context.fireDoneParsingEntity(WSDLConstants.QNAME_PART, part); return part; }
protected boolean isSingleInOutPart(Set inputParameterNames, MessagePart outputPart) { // As of now, we dont have support for in/out in doc-lit. So return false. SOAPOperation soapOperation = (SOAPOperation) getExtensionOfType(info.bindingOperation, SOAPOperation.class); if ((soapOperation != null) && (soapOperation.isDocument() || info.soapBinding.isDocument())) { Iterator iter = getInputMessage().parts(); while (iter.hasNext()) { MessagePart part = (MessagePart) iter.next(); if (outputPart.getName().equals(part.getName()) && outputPart.getDescriptor().equals(part.getDescriptor())) { return true; } } } else if (soapOperation != null && soapOperation.isRPC() || info.soapBinding.isRPC()) { com.sun.tools.ws.wsdl.document.Message inputMessage = getInputMessage(); if (inputParameterNames.contains(outputPart.getName())) { if (inputMessage.getPart(outputPart.getName()).getDescriptor().equals(outputPart.getDescriptor())) { return true; } } } return false; }
public static List<Parameter> createRpcLitParameters(Message message, Block block, S2JJAXBModel jaxbModel, ErrorReceiverFilter errReceiver){ RpcLitStructure rpcStruct = (RpcLitStructure)block.getType(); List<Parameter> parameters = new ArrayList<Parameter>(); for(MessagePart part : message.getParts()){ if(!ModelerUtils.isBoundToSOAPBody(part)) continue; QName name = part.getDescriptor(); TypeAndAnnotation typeAndAnn = jaxbModel.getJavaType(name); if(typeAndAnn == null){ String msgQName = "{"+message.getDefining().getTargetNamespaceURI()+"}"+message.getName(); errReceiver.error(part.getLocator(), ModelerMessages.WSDLMODELER_RPCLIT_UNKOWNSCHEMATYPE(name.toString(), part.getName(), msgQName)); throw new AbortException(); } String type = typeAndAnn.getTypeClass().fullName(); type = ClassNameInfo.getGenericClass(type); RpcLitMember param = new RpcLitMember(new QName("", part.getName()), type); JavaType javaType = new JavaSimpleType(new JAXBTypeAndAnnotation(typeAndAnn)); param.setJavaType(javaType); rpcStruct.addRpcLitMember(param); Parameter parameter = ModelerUtils.createParameter(part.getName(), param, block); parameter.setEmbedded(true); parameters.add(parameter); } return parameters; }