JType qnameType = model._ref(QName.class);
JType soapTransType = model._ref(SoapTransport.class);
JType hashMapType = model._ref(HashMap.class);
JVar tmVar = create.body().decl(tmType, "tm", JExpr.direct("org.codehaus.xfire.XFireFactory.newInstance().getXFire().getTransportManager()"));
JInvocation asfCons = JExpr._new(asfType);
asfCons.arg(JExpr._new(jsr181Type));
asfCons.arg(tmVar);
asfCons.arg(context.getSchemaGenerator().getBindingProviderExpr(context));
JVar propsVar = create.body().decl(hashMapType, "props", JExpr._new(hashMapType));
create.body().add(propsVar.invoke("put").arg("annotations.allow.interface").arg(JExpr.TRUE));
JVar asfVar = create.body().decl(asfType, "asf", asfCons);
JInvocation createInvoke = asfVar.invoke("create");
createInvoke.arg(JExpr.direct(serviceIntf.fullName() + ".class"));
createInvoke.arg(propsVar);
JInvocation bindingCreation = asfVar.invoke("setBindingCreationEnabled");
bindingCreation.arg(JExpr.lit(false));
create.body().add(bindingCreation);
JType serviceType = model._ref(Service.class);
create.body().assign(serviceVar, createInvoke);
for (Iterator itr = service.getBindings().iterator(); itr.hasNext();)
{
Binding binding = (Binding) itr.next();
if (!(binding instanceof AbstractSoapBinding)) continue;
AbstractSoapBinding soapBinding = (AbstractSoapBinding) binding;
JBlock block = create.body().block();
JInvocation createBinding;
if (soapBinding instanceof Soap12Binding)
{
createBinding = asfVar.invoke("createSoap12Binding");
}
else
{
createBinding = asfVar.invoke("createSoap11Binding");
}
createBinding.arg(serviceVar);
JInvocation newQN = JExpr._new(qnameType);
newQN.arg(soapBinding.getName().getNamespaceURI());
newQN.arg(soapBinding.getName().getLocalPart());
createBinding.arg(newQN);
createBinding.arg(soapBinding.getBindingId());
JVar sbVar = block.decl(abSoapBindingType, "soapBinding", createBinding);
}